Package com.pnfsoftware.jeb.util.collect
Class BiMap<K,V>
java.lang.Object
com.pnfsoftware.jeb.util.collect.BiMap<K,V>
- Type Parameters:
K
- key type; must have correct equals/hashCodeV
- value type; must have correct equals/hashCode
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.
-
Constructor Summary
ConstructorsConstructorDescriptionBiMap()
Create a new bi-map.BiMap
(CollectionOrder keyOrder) Create a new bi-map. -
Method Summary
Modifier and TypeMethodDescriptionasMap()
void
clear()
boolean
containsKey
(K key) boolean
containsValue
(V value) getKeyForValue
(V value) boolean
isEmpty()
keySet()
void
removeValue
(V value) int
size()
toString()
values()
-
Constructor Details
-
BiMap
public BiMap()Create a new bi-map. -
BiMap
Create a new bi-map.- Parameters:
keyOrder
-
-
-
Method Details