com.jogamp.common.util
Class IntLongHashMap

java.lang.Object
  extended by com.jogamp.common.util.IntLongHashMap
All Implemented Interfaces:
java.lang.Iterable

public class IntLongHashMap
extends java.lang.Object
implements java.lang.Iterable

Fast HashMap for primitive data. Optimized for being GC friendly. Original code is based on the skorpios project released under new BSD license.

Author:
Michael Bien, Simon Goller
See Also:
IntObjectHashMap, IntIntHashMap, LongObjectHashMap, LongLongHashMap, LongIntHashMap

Nested Class Summary
static class IntLongHashMap.Entry
          An entry mapping a key to a value.
 
Constructor Summary
IntLongHashMap()
           
IntLongHashMap(int initialCapacity)
           
IntLongHashMap(int initialCapacity, float loadFactor)
           
 
Method Summary
 void clear()
          Clears the entire map.
 boolean containsKey(int key)
           
 boolean containsValue(long value)
           
 long get(int key)
          Returns the value to which the specified key is mapped, or getKeyNotFoundValue() if this map contains no mapping for the key.
 long getKeyNotFoundValue()
          Returns the value which is returned if no value has been found for the specified key.
 java.util.Iterator iterator()
          Returns a new Iterator.
 long put(int key, long value)
          Maps the key to the specified value.
 long remove(int key)
          Removes the key-value mapping from this map.
 long setKeyNotFoundValue(long newKeyNotFoundValue)
          Sets the new key not found value.
 int size()
          Returns the current number of key-value mappings in this map.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntLongHashMap

public IntLongHashMap()

IntLongHashMap

public IntLongHashMap(int initialCapacity)

IntLongHashMap

public IntLongHashMap(int initialCapacity,
                      float loadFactor)
Method Detail

containsValue

public boolean containsValue(long value)

containsKey

public boolean containsKey(int key)

get

public long get(int key)
Returns the value to which the specified key is mapped, or getKeyNotFoundValue() if this map contains no mapping for the key.


put

public long put(int key,
                long value)
Maps the key to the specified value. If a mapping to this key already exists, the previous value will be returned (otherwise getKeyNotFoundValue()).


remove

public long remove(int key)
Removes the key-value mapping from this map. Returns the previously mapped value or getKeyNotFoundValue() if no such mapping exists.


size

public int size()
Returns the current number of key-value mappings in this map.


clear

public void clear()
Clears the entire map. The size is 0 after this operation.


iterator

public java.util.Iterator iterator()
Returns a new Iterator. Note: this Iterator does not yet support removal of elements.

Specified by:
iterator in interface java.lang.Iterable

setKeyNotFoundValue

public long setKeyNotFoundValue(long newKeyNotFoundValue)
Sets the new key not found value. For primitive types (int, long) the default is -1, for Object types, the default is null.

Returns:
the previous key not found value
See Also:
get(int), put(int, long)

getKeyNotFoundValue

public long getKeyNotFoundValue()
Returns the value which is returned if no value has been found for the specified key.

See Also:
get(int), put(int, long)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object