Class BiMapV>
java.lang.Object
com.itextpdf.commons.datastructures.BiMapV>
- Type Parameters:
-
K
- the type of the first key -
V
- the type of the second key
A simple bi-directional map.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
removes all entries from the map.boolean
containsKey
(K k) Checks if the map contains the key.boolean
containsValue
(V v) Checks if the map contains the value.Gets the value by key.getByValue
(V key) Gets the key by value.boolean
isEmpty()
Checks if the map is empty.void
Puts the entry into the map.void
removeByKey
(K k) Removes the entry by key.void
removeByValue
(V v) Removes the entry by value.int
size()
Gets the size of the map.
-
Constructor Details
-
BiMap
public BiMap()Creates a newBiMap
instance.
-
-
Method Details
-
put
Puts the entry into the map. If the key already exists, the value will be overwritten. If the value already exists, the key will be overwritten. If both key and value already exist, the entry will be overwritten. If neither key nor value already exist, the entry will be added.- Parameters:
-
k
- the key -
v
- the value
-
getByKey
Gets the value by key.- Parameters:
-
value
- the key - Returns:
- the value
-
getByValue
Gets the key by value.- Parameters:
-
key
- the value - Returns:
- the key
-
removeByKey
Removes the entry by key.- Parameters:
-
k
- the key
-
removeByValue
Removes the entry by value.- Parameters:
-
v
- the value
-
size
public int size()Gets the size of the map.- Returns:
- the size of the map
-
clear
public void clear()removes all entries from the map. -
isEmpty
public boolean isEmpty()Checks if the map is empty.- Returns:
- true, if the map is empty
-
containsKey
Checks if the map contains the key.- Parameters:
-
k
- the key - Returns:
- true, if the map contains the key
-
containsValue
Checks if the map contains the value.- Parameters:
-
v
- the value - Returns:
- true, if the map contains the value
-