Class DualIntMap<V>

java.lang.Object
net.dermetfan.gdx.utils.DualIntMap<V>

public class DualIntMap<V>
extends java.lang.Object
an IntMap and ObjectIntMap holding each others contents in reverse for fast retrieval of both keys and values
Since:
0.6.0
  • Constructor Summary

    Constructors
    Constructor Description
    DualIntMap()  
    DualIntMap​(int initialCapacity)  
    DualIntMap​(int initialCapacity, float loadFactor)  
    DualIntMap​(com.badlogic.gdx.utils.IntMap<V> map)  
    DualIntMap​(DualIntMap<V> map)  
  • Method Summary

    Modifier and Type Method Description
    int getKey​(V value, int defaultKey)  
    com.badlogic.gdx.utils.IntMap<V> getKeyToValue()  
    V getValue​(int key)  
    com.badlogic.gdx.utils.ObjectIntMap<V> getValueToKey()  
    void put​(int key, V value)  
    V removeKey​(int key)  
    int removeValue​(V value, int defaultKey)
    like what intMap.remove(intMap.findKey(value, true, defaultValue)) would do

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DualIntMap

      public DualIntMap()
      See Also:
      IntMap()
    • DualIntMap

      public DualIntMap​(int initialCapacity)
      See Also:
      IntMap(int)
    • DualIntMap

      public DualIntMap​(int initialCapacity, float loadFactor)
      See Also:
      IntMap(int, float)
    • DualIntMap

      public DualIntMap​(com.badlogic.gdx.utils.IntMap<V> map)
      See Also:
      IntMap(IntMap)
    • DualIntMap

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

    • put

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

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

      public V getValue​(int key)
      See Also:
      IntMap.get(int)
    • removeKey

      public V removeKey​(int key)
      See Also:
      IntMap.remove(int)
    • removeValue

      public int removeValue​(V value, int defaultKey)
      like what intMap.remove(intMap.findKey(value, true, defaultValue)) would do
    • getKeyToValue

      public com.badlogic.gdx.utils.IntMap<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.ObjectIntMap<V> getValueToKey()
      Returns:
      The valueToKey. Only use this if you know what you're doing!
      Since:
      0.7.1