public class BidirectionalMap<S,T> extends java.lang.Object
Constructor and Description |
---|
BidirectionalMap()
Creates new bidirectional map based on hash maps.
|
BidirectionalMap(java.util.Map<S,T> stMap,
java.util.Map<T,S> tsMap)
Creates new bidirectional map based given maps.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the map.
|
boolean |
containsFirst(S s)
Returns whether the given element is in the first set (the domain of the
bijection).
|
boolean |
containsSecond(T t)
Returns whether the given element is in the second set (the range of the
bijection).
|
UnmodifiableSet<java.util.Map.Entry<S,T>> |
getEntrySet()
Returns the entries.
|
S |
getFirst(T t)
Get first element.
|
UnmodifiableSet<S> |
getFirstSet()
Returns the first set (the domain).
|
UnmodifiableSet<java.util.Map.Entry<T,S>> |
getInvertedEntrySet()
Returns the inverted entries.
|
T |
getSecond(S s)
Get second element.
|
UnmodifiableSet<T> |
getSecondSet()
Returns the second set (the range).
|
boolean |
isEmpty()
Returns whether this map is empty.
|
void |
put(S s,
T t)
Inserts the given pair into the bijection.
|
void |
removeFirst(S s)
Removes the first object
|
void |
removeSecond(T t)
Removes the second object
|
int |
size()
Returns the size.
|
java.lang.String |
toString() |
public BidirectionalMap()
public BidirectionalMap(java.util.Map<S,T> stMap, java.util.Map<T,S> tsMap)
public boolean isEmpty()
public int size()
public void clear()
public boolean containsFirst(S s)
public boolean containsSecond(T t)
public UnmodifiableSet<S> getFirstSet()
public UnmodifiableSet<T> getSecondSet()
public UnmodifiableSet<java.util.Map.Entry<S,T>> getEntrySet()
public UnmodifiableSet<java.util.Map.Entry<T,S>> getInvertedEntrySet()
public void put(S s, T t)
public void removeFirst(S s)
public void removeSecond(T t)
public java.lang.String toString()
toString
in class java.lang.Object