public static void main(String[] args) {
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
Map map1 = new HashMap();
map1.put("key1", "value1");
list.add(map1);
Map map2 = new HashMap();
map2.put("key2", "value2");
list.add(map2);
Map map3 = new HashMap();
map3.put("key3", "value3");
list.add(map3);
System.out.println(list);
list = list.stream().filter(s->!StringUtils.equals(s.get("key2"),"value2")).collect(Collectors.toList());
System.out.println(list);
}
输出:
[{key1=value1}, {key2=value2}, {key3=value3}]
[{key1=value1}, {key3=value3}]