【发布时间】:2019-01-24 11:58:54
【问题描述】:
给定一个 Map,我如何查找与特定值关联的所有键?
例如:
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
map.put(1, 5);
map.put(2, 2);
map.put(3, 5);
Collection<Integer> keys = map.values(5); // should return {1, 3}
我正在寻找类似于 Google Collections 的 BiMap 的东西,其中值不是唯一的。
【问题讨论】:
标签: java collections