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
    K getKey​(V value)  
    com.badlogic.gdx.utils.ObjectMap<K,​V> getKeyToValue()  
    V getValue​(K key)  
    com.badlogic.gdx.utils.ObjectMap<V,​K> getValueToKey()  
    void put​(K key, V value)  
    V removeKey​(K key)  
    K removeValue​(V value)
    like what objectMap.remove(objectMap.findKey(value)) would do

    Methods 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

      public DualObjectMap​(com.badlogic.gdx.utils.ObjectMap<K,​V> map)
      See Also:
      ObjectMap(ObjectMap)
    • DualObjectMap

      public DualObjectMap​(DualObjectMap<K,​V> map)
      Parameters:
      map - the map to copy
  • Method Details

    • put

      public void put​(K key, V value)
      See Also:
      ObjectMap.put(Object, Object)
    • getKey

      public K getKey​(V value)
      Returns:
      the key of the given value as ObjectMap.findKey(Object, boolean) would return
    • getValue

      public V getValue​(K key)
      See Also:
      ObjectMap.get(Object)
    • removeKey

      public V removeKey​(K key)
      See Also:
      ObjectMap.remove(Object)
    • removeValue

      public K removeValue​(V value)
      like what objectMap.remove(objectMap.findKey(value)) would do
    • getKeyToValue

      public com.badlogic.gdx.utils.ObjectMap<K,​V> getKeyToValue()
      Returns:
      The keyToValue. Only use this if you know what you're doing!
      Since:
      0.7.1
    • getValueToKey

      public com.badlogic.gdx.utils.ObjectMap<V,​K> getValueToKey()
      Returns:
      The valueToKey. Only use this if you know what you're doing!
      Since:
      0.7.1