List list = new ArrayList(); // 在这里添加元素以进行过滤。 List filteredList = list.stream().filter(o -> { try { for (Field f : o.getClass().getDeclaredFields()) { f.setAccessible(true); if (f.get(o) != null) return false; } } catch (Exception e) { e.printStackTrace(); } return true; }).collect(Collectors.toList());
上一篇:按距离(经度,纬度)对列表进行排序
下一篇:按具有子属性的行数据分组