Set<Long> ids = feeList.stream().filter(s ->Objects.nonNull(s.getBill())); 相关参考https://www.javaroad.cn/articles/2342 转载:jdk8 lambda过滤集合中对象为空的数据