List<Map<String,Object>> childrenList = orderList.stream()
.filter(fr2 -> getLong(fr2.get("shipApplyId")).equals(getLong(fh.get("id"))))
.collect(Collectors.groupingBy(gb2 -> new Tuple(gb2.get("companyCode"), gb2.get("cargoInfoCode"),
gb2.get("tradeType"), gb2.get("inoutType"), gb2.get("cargoAgentId"), gb2.get("shipperId"))))
.entrySet()
.stream()
.map(m2 -> {
Map<String,Object> idMap = new HashMap<>();
idMap.putAll(m2.getValue().get(0));
String idList = m2.getValue().stream().map(m3 -> getString(m3.get("id"))).distinct().collect(Collectors.joining(","));
idMap.put("idList", idList);
idMap.put("fid", getLong(fh.get("id")));
return idMap;
}).collect(Collectors.toList());
stream流运用Tuple多元素分组
最新推荐文章于 2023-03-21 13:23:10 发布