📅  最后修改于: 2022-03-11 14:52:25.990000             🧑  作者: Mango
Map> reverseMap = new HashMap<>();
for (Map.Entry entry : map.entrySet()) {
if (!reverseMap.containsKey(entry.getValue())) {
reverseMap.put(entry.getValue(), new ArrayList<>());
}
ArrayList keys = reverseMap.get(entry.getValue());
keys.add(entry.getKey());
reverseMap.put(entry.getValue(), keys);
}