java.lang.Object | |
↳ | com.pnfsoftware.jeb.util.collect.BiMap<K, V> |
A bidirectional map of key-values. This class is serialializable
. The null key and
null value are forbidden. The key-value mapping is one-to-one: a key can only map to one value,
and one value can only map to one key. (One consequence is that putting
a key-value pair may either increment, keep the same, or even decrement the map size.
Thread-safety: none.
Note: this class does not implement the Map interface, but attempts to follow its guidelines and contracts the best it can. One notable exception is that this class does not override hashCode/equals.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BiMap()
Create a new bi-map.
| |||||||||||
BiMap(CollectionOrder keyOrder)
Create a new bi-map.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Map<K, V> | asMap() | ||||||||||
Map<V, K> | asReverseMap() | ||||||||||
void | clear() | ||||||||||
boolean | containsKey(K key) | ||||||||||
boolean | containsValue(V value) | ||||||||||
V | get(K key) | ||||||||||
K | getKeyForValue(V value) | ||||||||||
boolean | isEmpty() | ||||||||||
Set<K> | keySet() | ||||||||||
V | put(K key, V value) | ||||||||||
void | putAll(Map<? extends K, ? extends V> m) | ||||||||||
V | remove(K key) | ||||||||||
K | removeValue(V value) | ||||||||||
int | size() | ||||||||||
String | toString() | ||||||||||
Set<V> | values() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Create a new bi-map.