com.hazelcast.util.collection

## Class Long2LongHashMap

- java.lang.Object
- - com.hazelcast.util.collection.Long2LongHashMap

- All Implemented Interfaces:
    Map<Long,Long>

      public class Long2LongHashMap
      extends Object
      implements Map<Long,Long>

  A Probing hashmap specialised for long key and value pairs.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Long2LongHashMap.LongIterator` Adds an unboxed next() method to the standard Iterator interface.
    `class` | `Long2LongHashMap.LongLongCursor` Implements the cursor.

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,V>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_INITIAL_CAPACITY` The default initial capacity for constructors not explicitly supplying it
    `static double` | `DEFAULT_LOAD_FACTOR` The default load factor for constructors not explicitly supplying it

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Long2LongHashMap(int initialCapacity, double loadFactor, long missingValue)`
    `Long2LongHashMap(long missingValue)`
    `Long2LongHashMap(Long2LongHashMap that)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `boolean` | `containsKey(long key)` Long primitive specialised containsKey.
    `boolean` | `containsKey(Object key)`
    `boolean` | `containsValue(long value)`
    `boolean` | `containsValue(Object value)`
    `Long2LongHashMap.LongLongCursor` | `cursor()` Provides a cursor over the map's entries.
    `Set<Map.Entry<Long,Long>>` | `entrySet()` This set's iterator also implements `Map.Entry` so the `next()` method can just return the iterator instance itself with no heap allocation.
    `void` | `forEach(BiConsumer<? super Long,? super Long> action)`
    `long` | `get(long key)`
    `Long` | `get(Object key)`
    `boolean` | `isEmpty()`
    `Set<Long>` | `keySet()`
    `void` | `longForEach(LongLongConsumer consumer)` Primitive specialised forEach implementation.
    `long` | `put(long key, long value)`
    `Long` | `put(Long key, Long value)`
    `void` | `putAll(Map<? extends Long,? extends Long> map)`
    `long` | `remove(long key)`
    `Long` | `remove(Object key)`
    `int` | `size()`
    `String` | `toString()`
    `Collection<Long>` | `values()`

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

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

    - ### Methods inherited from interface java.util.Map

      `compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll`

- - ### Field Detail

    - #### DEFAULT_LOAD_FACTOR

          public static final double DEFAULT_LOAD_FACTOR

      The default load factor for constructors not explicitly supplying it
      See Also:
        Constant Field Values

    - #### DEFAULT_INITIAL_CAPACITY

          public static final int DEFAULT_INITIAL_CAPACITY

      The default initial capacity for constructors not explicitly supplying it
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Long2LongHashMap

          public Long2LongHashMap(int initialCapacity,
                                  double loadFactor,
                                  long missingValue)

    - #### Long2LongHashMap

          public Long2LongHashMap(long missingValue)

    - #### Long2LongHashMap

          public Long2LongHashMap(Long2LongHashMap that)

  - ### Method Detail

    - #### size

          public int size()

      Specified by:
        `size` in interface `Map<Long,Long>`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `Map<Long,Long>`

    - #### get

          public long get(long key)

    - #### put

          public long put(long key,
                          long value)

    - #### longForEach

          public void longForEach(LongLongConsumer consumer)

      Primitive specialised forEach implementation.

      NB: Renamed from forEach to avoid overloading on parameter types of lambda expression, which doesn't interplay well with type inference in lambda expressions.
      Parameters:
        `consumer` - a callback called for each key/value pair in the map.

    - #### cursor

          public Long2LongHashMap.LongLongCursor cursor()

      Provides a cursor over the map's entries. Similar to `entrySet().iterator()`, but with a simpler and more clear API.

    - #### containsKey

          public boolean containsKey(long key)

      Long primitive specialised containsKey.
      Parameters:
        `key` - the key to check.
      Returns:
        true if the map contains key as a key, false otherwise.

    - #### containsValue

          public boolean containsValue(long value)

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Map<Long,Long>`

    - #### get

          public Long get(Object key)

      Specified by:
        `get` in interface `Map<Long,Long>`

    - #### put

          public Long put(Long key,
                          Long value)

      Specified by:
        `put` in interface `Map<Long,Long>`

    - #### forEach

          public void forEach(BiConsumer<? super Long,? super Long> action)

    - #### containsKey

          public boolean containsKey(Object key)

      Specified by:
        `containsKey` in interface `Map<Long,Long>`

    - #### containsValue

          public boolean containsValue(Object value)

      Specified by:
        `containsValue` in interface `Map<Long,Long>`

    - #### putAll

          public void putAll(Map<? extends Long,? extends Long> map)

      Specified by:
        `putAll` in interface `Map<Long,Long>`

    - #### keySet

          public Set<Long> keySet()

      Specified by:
        `keySet` in interface `Map<Long,Long>`

    - #### values

          public Collection<Long> values()

      Specified by:
        `values` in interface `Map<Long,Long>`

    - #### entrySet

          public Set<Map.Entry<Long,Long>> entrySet()

      This set's iterator also implements `Map.Entry` so the `next()` method can just return the iterator instance itself with no heap allocation. This characteristic makes the set unusable wherever the returned entries are retained (such as `coll.addAll(entrySet)`.
      Specified by:
        `entrySet` in interface `Map<Long,Long>`

    - #### remove

          public Long remove(Object key)

      Specified by:
        `remove` in interface `Map<Long,Long>`

    - #### remove

          public long remove(long key)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2019. All rights reserved.