List<Long> listIds = Arrays.asList(str.split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
List<Long> newSkuIdList = skuIdList.stream().distinct().skip((currentPage - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
Map<Long, String> openIdMap = list.stream()
.collect(Collectors.toMap(User::getUserId, User::getXcxOpenId));
这篇文章不错:
https://www.cnblogs.com/wenbronk/p/7300544.html
BigDecimal add = list.stream().map(User::getHeight).reduce(BigDecimal.ZERO, BigDecimal::add);
提取集合里的id集合:
foodBasicList.stream()
.map(FoodBasic::getId).collect(Collectors.toList())
集合转map:foodBasicList.stream().collect(Collectors.toMap(FoodCountModel::getId, FoodCountModel::getSoldCount))
BigDecimal yearSaleMoney = list.stream().filter(s -> s.getNum() == 0).collect(Collectors.toList()).get(0).getSaleMoney();
List<Long> newAddressList = addressList.stream().map(s -> Long.valueOf(s)).collect(Collectors.toList());
java8 list统计(求和、最大、最小、平均):
https://blog.csdn.net/baobaodehao1991/article/details/81332584
//2.根据拼团商品的排序规则,排序商品 sortList.stream().forEach(s -> foodBasicList.stream() .filter(y -> s.equals(String.valueOf(y.getId()))).forEach(f -> fBasicList.add(f))); //或者是下面的方法 // sortList.stream().forEach(item -> { // foodBasicList.stream().forEach(y -> { // if (Long.valueOf(item) == y.getId()) { // fBasicList.add(y); // } // }); // });
JDK1.8对List指定字段进行排序:
http://www.mamicode.com/info-detail-2356310.html
java.util.Objects.equals(k, "E") java.util.Objects.nonNull(map)