List<对象>遍历
list.stream().forEach(item-> { XXX业务 });
List<对象> 判定是否存在符合条件的对象
Boolean exists = list.stream().filter(item-> (123).equals((Integer) item.get("id"))).findFirst().isPresent();
List<对象> 某个属性求和
list.stream().mapToInt(inspection -> Integer.parseInt(inspection.get("filed").toString())).sum();
List<对象> 转 List<Map<String, Object>
List<Map<String, Object>> result= list.stream().map((item-> { Map<String, Object> map = new HashMap<>(); map.put("cardId", item.getId()); map.put("cardNo", item.getCardNo());
return map; })).collect(Collectors.toList());
参考地址二
https://blog.csdn.net/SeniorShen/article/details/120061248
浙公网安备 33010602011771号