list 中 stream 判空
摘要:问题: 1.在对使用lamda表达式的stream对list进行处理时,如果list是null将会有让人难受的NPE 2.在每个list.stream()前都if(list!=null)又不够优雅 3.在对list中对象进行操作时也得if()避免NPE,代码显得臃肿 优雅解决: 1.在操作前对lis
阅读全文
posted @ 2022-12-09 11:25
posted @ 2022-12-09 11:25