Stream流,将实体对象集合转化成map数据类型:(id:实体类)

使用Stream流将一个实体类集合化成map数据类型:(id:实体类)代码如下:

 Map<String, Units> orderAdvancePaymentDetailMap = units.stream()
          .collect(Collectors.toMap(Units::getName, Function.identity()));

猜你喜欢

转载自blog.csdn.net/m0_63364103/article/details/130226900