removeIf(去除)过滤Map对象中“y”的值等于“0”的值,剩下的都是不为“0”的值
public List<Map> filterZero(List<Map> map) {
map.removeIf(item -> "0".equals(item.get("y").toString()));
return map;
}
filter过滤Map对象中“y”的值等于“0”的值,获取到等于“0”的对象
public List<Map> filterZero(List<Map> map) {
Stream<Map> streamMap= map.stream().filter(item->"0".equals(item.get("y")));
List<Map> resultMap = streamMap.collect(Collectors.toList());
return resultMap;
}