![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java8
东耳佳茗
东耳佳茗,一个有故事的程序员!
展开
-
JAVA8 filter对List筛选、排序报nullPointException
1、模糊查询,通过ShardsInfoDto.getIndexName()!=null 判断防止indexName为空报空指针异常String indexName = "asd"; shardsList = shardsList.stream().filter(ShardsInfoDto -> ShardsInfoDto.getIndexName()!=null&&ShardsInfoDto.getIndexName().indexOf(indexName) &.原创 2021-04-21 19:56:52 · 1787 阅读 · 2 评论 -
使用JAVA8 filter对List多条件模糊筛选、单个参数多个值过滤、多个参数联合排序
对于从缓存中获取的list集合如果根据条件进行模糊查询呢?条件根据indexName字段筛选需要的值1、造数据List<ShardsInfoDto> shardsList = new ArrayList<>(); ShardsInfoDto shardsInfoDto = new ShardsInfoDto(); shardsInfoDto.setIndexName("chenming20210416"); shardsI原创 2021-04-21 19:42:16 · 13166 阅读 · 0 评论