Package net.dermetfan.gdx.utils
Class DualObjectMap<K,V>
java.lang.Object
net.dermetfan.gdx.utils.DualObjectMap<K,V>
public class DualObjectMap<K,V>
extends java.lang.Object
Two
ObjectMaps holding each other's contents in reverse for fast retrieval of both keys and values.
This causes null values not to be allowed.- Since:
- 0.6.0
-
Constructor Summary
Constructors Constructor Description DualObjectMap()DualObjectMap(int initialCapacity)DualObjectMap(int initialCapacity, float loadFactor)DualObjectMap(com.badlogic.gdx.utils.ObjectMap<K,V> map)DualObjectMap(DualObjectMap<K,V> map) -
Method Summary
Modifier and Type Method Description KgetKey(V value)com.badlogic.gdx.utils.ObjectMap<K,V>getKeyToValue()VgetValue(K key)com.badlogic.gdx.utils.ObjectMap<V,K>getValueToKey()voidput(K key, V value)VremoveKey(K key)KremoveValue(V value)like whatobjectMap.remove(objectMap.findKey(value))would doMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
DualObjectMap
public DualObjectMap()- See Also:
ObjectMap()
-
DualObjectMap
public DualObjectMap(int initialCapacity)- See Also:
ObjectMap(int)
-
DualObjectMap
public DualObjectMap(int initialCapacity, float loadFactor)- See Also:
ObjectMap(int, float)
-
DualObjectMap
- See Also:
ObjectMap(ObjectMap)
-
DualObjectMap
- Parameters:
map- the map to copy
-
-
Method Details
-
put
- See Also:
ObjectMap.put(Object, Object)
-
getKey
- Returns:
- the key of the given value as
ObjectMap.findKey(Object, boolean)would return
-
getValue
- See Also:
ObjectMap.get(Object)
-
removeKey
- See Also:
ObjectMap.remove(Object)
-
removeValue
like whatobjectMap.remove(objectMap.findKey(value))would do -
getKeyToValue
- Returns:
- The
keyToValue. Only use this if you know what you're doing! - Since:
- 0.7.1
-
getValueToKey
- Returns:
- The
valueToKey. Only use this if you know what you're doing! - Since:
- 0.7.1
-