直接上干货
@Test
public void test() {
Map map1 = new HashMap(new HashMap<String, String>() {{
put("1", "1");
put("2", "1");
put("3", "1");
}});
Map map2 = new HashMap();
//获取map1和map2的交集
Collection intersection =
CollectionUtils.intersection(map1.keySet(), map2.keySet());
System.out.println("交集:" + intersection);
}