Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BiMap<K, V> implements Map<K, V> {
- private Map<K, V> values = Maps.newHashMap();
- private Map<V, K> keys = Maps.newHashMap();
- public void put(K k, V v) {
- values.put(k, v);
- keys.put(v, k);
- }
- public V get(K k) {
- return keys.get(k);
- }
- public K getKey(V v) {
- return values.get(v);
- }
- /* Everything else */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement