java8特性stream().map()

categoryTypeList //类目集合
productInfoList //商品信息集合
ProductInfo //每个商品信息
categoryType //商品类目

List categoryTypeList = productInfoList.stream()
                      .map(ProductInfo::getCategoryType)
                      .collect(Collectors.toList());

简单记一下吧,java8的新特性。
功能为: 将 “商品信息集合” 中 “每个商品信息” 的 “商品类目” 放在 “类目集合” 里面。

你可能感兴趣的:(java8特性stream().map())