Class BiMap<L,R>
java.lang.Object
io.github.kosmx.emotes.common.tools.BiMap<L,R>
- Type Parameters:
L-R-
- All Implemented Interfaces:
Iterable<it.unimi.dsi.fastutil.Pair<L,,R>> Collection<it.unimi.dsi.fastutil.Pair<L,R>>
Bi-directional hash-map.
Both L and R has to implement
Object.hashCode() and Object.equals(Object) functions
it can not be checked automatically, but DON'T forget it-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanOnly put the item into it, if it's not already there.booleanaddAll(Collection<? extends it.unimi.dsi.fastutil.Pair<L, R>> c) voidclear()booleanbooleancontainsAll(@NotNull Collection<?> c) booleanbooleanbooleaninthashCode()booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) Remove pair from L keyRemove pair from R keybooleanretainAll(@NotNull Collection<?> c) Retains only the elements in this collection that are contained in the specified collection.intsize()Object[]toArray()<T> T[]toArray(T[] a) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
BiMap
public BiMap()
-
-
Method Details
-
getR
-
getL
-
containsL
-
containsR
-
put
-
add
Only put the item into it, if it's not already there. seeCollection.add(Object)- Specified by:
addin interfaceCollection<L>- Parameters:
pair- pair of elements- Returns:
- true if the map changed.
-
removeL
Remove pair from L key- Parameters:
l- key- Returns:
- the removed R
-
removeR
Remove pair from R key- Parameters:
r- key- Returns:
- the removed L
-
remove
- Specified by:
removein interfaceCollection<L>
-
containsAll
- Specified by:
containsAllin interfaceCollection<L>
-
addAll
- Specified by:
addAllin interfaceCollection<L>
-
removeAll
- Specified by:
removeAllin interfaceCollection<L>
-
retainAll
Retains only the elements in this collection that are contained in the specified collection. Code copied from standard lib but runs with my iterator...- Specified by:
retainAllin interfaceCollection<L>- Parameters:
c- collection- Returns:
- was the map modified
-
clear
public void clear()- Specified by:
clearin interfaceCollection<L>
-
size
public int size()- Specified by:
sizein interfaceCollection<L>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<L>
-
contains
- Specified by:
containsin interfaceCollection<L>
-
iterator
-
toArray
- Specified by:
toArrayin interfaceCollection<L>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceCollection<L>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<L>- Overrides:
hashCodein classObject
-
equals
- Specified by:
equalsin interfaceCollection<L>- Overrides:
equalsin classObject
-