com.jogamp.common.util

## Class LongIntHashMap

- java.lang.Object
- - com.jogamp.common.util.LongIntHashMap

- All Implemented Interfaces:
    Cloneable, Iterable<LongIntHashMap.Entry>

      public class LongIntHashMap
      extends Object
      implements Cloneable, Iterable<LongIntHashMap.Entry>

  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, Sven Gothel
  See Also:
    `IntObjectHashMap`, `IntLongHashMap`, `LongObjectHashMap`, `LongLongHashMap`, `IntIntHashMap`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `LongIntHashMap.Entry` An entry mapping a key to a value.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LongIntHashMap()`
    `LongIntHashMap(int initialCapacity)`
    `LongIntHashMap(int initialCapacity, float loadFactor)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `capacity()` Returns the current capacity (buckets) in this map.
    `void` | `clear()` Clears the entire map.
    `Object` | `clone()` Disclaimer: If the value type doesn't implement `clone()`, only the reference is copied.
    `boolean` | `containsKey(long key)`
    `boolean` | `containsValue(int value)`
    `int` | `get(long key)` Returns the value to which the specified key is mapped, or `getKeyNotFoundValue()` if this map contains no mapping for the key.
    `int` | `getKeyNotFoundValue()` Returns the value which is returned if no value has been found for the specified key.
    `Iterator<LongIntHashMap.Entry>` | `iterator()` Returns a new `Iterator`.
    `int` | `put(long key, int value)` Maps the key to the specified value.
    `void` | `putAll(LongIntHashMap source)` Copies all of the mappings from the specified map to this map.
    `int` | `remove(long key)` Removes the key-value mapping from this map.
    `int` | `setKeyNotFoundValue(int newKeyNotFoundValue)` Sets the new key not found value.
    `int` | `size()` Returns the current number of key-value mappings in this map.
    `String` | `toString()`
    `StringBuilder` | `toString(StringBuilder sb)`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### LongIntHashMap

          public LongIntHashMap()

    - #### LongIntHashMap

          public LongIntHashMap(int initialCapacity)

    - #### LongIntHashMap

          public LongIntHashMap(int initialCapacity,
                        float loadFactor)

  - ### Method Detail

    - #### clone

          public Object clone()

      Disclaimer: If the value type doesn't implement `clone()`, only the reference is copied. Note: Due to private fields we cannot implement a copy constructor, sorry.
      Overrides:
        `clone` in class `Object`
      Parameters:
        `source` - the primitive hash map to copy

    - #### containsValue

          public boolean containsValue(int value)

    - #### containsKey

          public boolean containsKey(long key)

    - #### get

          public int get(long key)

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

    - #### put

          public int put(long key,
                int value)

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

    - #### putAll

          public void putAll(LongIntHashMap source)

      Copies all of the mappings from the specified map to this map.

    - #### remove

          public int remove(long 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.

    - #### capacity

          public int capacity()

      Returns the current capacity (buckets) in this map.

    - #### clear

          public void clear()

      Clears the entire map. The size is 0 after this operation.

    - #### iterator

          public Iterator<LongIntHashMap.Entry> iterator()

      Returns a new `Iterator`. Note: this Iterator does not yet support removal of elements.
      Specified by:
        `iterator` in interface `Iterable<LongIntHashMap.Entry>`

    - #### setKeyNotFoundValue

          public int setKeyNotFoundValue(int 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(long)`, `put(long, int)`

    - #### getKeyNotFoundValue

          public int getKeyNotFoundValue()

      Returns the value which is returned if no value has been found for the specified key.
      See Also:
        `get(long)`, `put(long, int)`

    - #### toString

          public StringBuilder toString(StringBuilder sb)

      Parameters:
        `sb` - if null, a new StringBuilder is created
      Returns:
        StringBuilder instance with appended string information of this Entry

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`