List<Paper> list = new ArrayList<>();
list.add(new Paper("m",2L));
list.add(new Paper("a",1L));
list.add(new Paper("j",3L));
list.add(new Paper("t",4L));
list.add(new Paper("b",5L));

遍历:
list.stream().forEach(item ->{

});

排序: List<Paper> collect = list.stream().sorted(Comparator.comparing(Paper::getPaperName)).collect(Collectors.toList());

分组:Map<String, List<Paper>> collect =list.stream().collect(Collectors.groupingBy(Paper::getPY))
最大最小值:

Optional<Paper> max =list.stream().max(Comparator.comparing(Paper::getPaperName));
if (max.isPresent()) {//防止空指针
......
}

转换map:
Map<Long, String> collect2 = list.stream().collect(Collectors.toMap(Paper::getPaperId, Paper::getPaperName));

过滤:
Optional<Paper> min = x.getSchedulingList().stream().filter(s -> s.id()>=1).min(Comparator.comparing(Paper::getPaperName));
价格类属性累加:
orderList.stream().map(OrderEntity::getRealFee).reduce(BigDecimal.ZERO, BigDecimal::add);

判断重复重:
if(partitionCamera.stream().anyMatch(item->
item.getChannelNo().compareTo(deviceCamera.getChannelNo())==0 && item.getDeviceSerial().equals(deviceCamera.getDeviceSerial()))){
}

转map避免控指针
Map<String, String> map = xdsList.stream().collect(Collectors.toMap(XdsDtuEntity::getXMac, e->e.getXDtuDescribe()==null?"":e.getXDtuDescribe()));

将集合转为map 属性做键 对象做值
hutool 5.5.2版本
CollStreamUtil.toIdentityMap(hzOptionList, HzOption::getId)

 

最新文章

  1. caffe源码解析
  2. java画图之曲线拖动
  3. js③
  4. 说说Timing这回事(转载)
  5. How-to: disable the web-security-check in Chrome for Mac
  6. CSS 确定选中变红色
  7. mysql 获取一个表中缺失的最小编号
  8. RegexOne
  9. 美H1B签证额满,硕士以上学位仍可申请
  10. core dump + LINUX 内核系列博客
  11. (转载)关于ArrayList的5道面试题
  12. Java IntelliJ IDEA 不能显示项目里的文件结构解决办法
  13. C# Winform中DataGridView的DataGridViewCheckBoxColumn CheckBox选中判断
  14. 使用three.js加载3dmax资源,以及实现场景中的阴影效果
  15. Spark源码分析 之 Driver和Excutor是怎么跑起来的?(2.2.0版本)
  16. x86汇编语言实践(3)
  17. BBS论坛(二十八)
  18. C# 数组与集合的区别
  19. LGP2801 教主的魔法
  20. 根据日志分析异常:There is already &#39;XXX&#39; bean method

热门文章

  1. java SE02
  2. uniapp - 设置代理
  3. taro 学习笔记
  4. Vue: 单页面应用如何保持登录状态
  5. solve--NAT模式下配置静态IP地址
  6. JSR 133
  7. efk部署
  8. Mybatis二级缓存(2)
  9. file的各种转换
  10. Rust字符串处理