转:https://blog.csdn.net/gsls200808/article/details/86501905
    //更新第2个List内容
    List newListOrder = listOrder.stream().map(orderpart ->
    listPartHave.stream().filter( one-> one.getPartno().equals(orderpart.getPartno())).findFirst().map(one -> {orderpart.setAmount(one.getAmount());return orderpart;}).orElse(null)
    ).collect(Collectors.toList());
    //去掉空
    newListOrder = newListOrder.stream().filter(orderpart -> orderpart != null
    ).collect(Collectors.toList());
    合计
    double amountsum = listSale.stream().mapToDouble(SaleListDetail::getAmount).sum();
    分组
    Map> groupBySaleNo = splitList.stream().collect(Collectors.groupingBy(SaleListDetail::getSaleno));

    通过groupingBy可以分组指定字段
    //分组
    Map> groupBySex = userList.stream().collect(Collectors.groupingBy(User::getSex));
    //遍历分组
    for (Map.Entry> entryUser : groupBySex.entrySet()) {
    String key = entryUser.getKey();
    List entryUserList = entryUser.getValue();
    }
    多字段分组

    1. Function<WarehouseReceiptLineBatch, List<Object>> compositeKey = wlb -><br /> Arrays.<Object>asList(wlb.getWarehouseReceiptLineId(), wlb.getWarehouseAreaId(), wlb.getWarehouseLocationId());<br /> Map<Object, List<WarehouseReceiptLineBatch>> map =<br /> warehouseReceiptLineBatchList.stream().collect(Collectors.groupingBy(compositeKey, Collectors.toList()));<br /> //遍历分组<br /> for (Map.Entry<Object, List<WarehouseReceiptLineBatch>> entryUser : map.entrySet()) {<br /> List<Object> key = (List<Object>) entryUser.getKey();<br /> List<WarehouseReceiptLineBatch> entryUserList = entryUser.getValue();<br /> Long warehouseReceiptLineId = (Long) key.get(0);<br /> Long warehouseAreaId = (Long) key.get(0);<br /> Long warehouseLocationId = (Long) key.get(0);<br /> <br /> }<br />取某一列<br /> List<String> names = list.stream().map(p -> p.getName()).collect(Collectors.toList());<br />String offernos = StringUtils._join_(listOfferno , **","**);