IntLongHashMap

open class IntLongHashMap(expectedElements: Int, loadFactor: Double = DEFAULT_LOAD_FACTOR.toDouble()) : Iterable<IntLongHashMap.IntLongCursor> , Accountable, Cloneable<IntLongHashMap>

A hash map of int to double, implemented using open addressing with linear probing for collision resolution.

Mostly forked and trimmed from com.carrotsearch.hppc.IntLongHashMap

github: https://github.com/carrotsearch/hppc release 0.10L

Constructors

Link copied to clipboard
constructor(expectedElements: Int, loadFactor: Double = DEFAULT_LOAD_FACTOR.toDouble())
constructor()

New instance with sane defaults.

constructor(map: IntLongHashMap)

Create a hash map from all key-value pairs of another map.

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Forked from HPPC, holding int index,key and value

Link copied to clipboard

A view of the keys inside this hash map.

Link copied to clipboard
abstract inner class LongContainer : Iterable<LongCursor>

LongCursor iterable with size and toArray function implemented

Properties

Link copied to clipboard

Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).

Link copied to clipboard
Link copied to clipboard

The array holding keys.

Link copied to clipboard

The array holding values.

Functions

Link copied to clipboard
fun addTo(key: Int, incrementValue: Long): Long

Adds incrementValue to any existing value for the given key or inserts incrementValue if key did not previously exist.

Link copied to clipboard
fun clear()
Link copied to clipboard
open override fun clone(): IntLongHashMap
Link copied to clipboard
Link copied to clipboard
fun ensureCapacity(expectedElements: Int)

Ensure this container can hold at least the given number of keys (entries) without resizing its buffers.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun get(key: Int): Long
Link copied to clipboard
fun getOrDefault(key: Int, defaultValue: Long): Long
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun indexExists(index: Int): Boolean
Link copied to clipboard
fun indexGet(index: Int): Long
Link copied to clipboard
fun indexInsert(index: Int, key: Int, value: Long)
Link copied to clipboard
fun indexOf(key: Int): Int
Link copied to clipboard
fun indexRemove(index: Int): Long
Link copied to clipboard
fun indexReplace(index: Int, newValue: Long): Long
Link copied to clipboard
open operator override fun iterator(): Iterator<IntLongHashMap.IntLongCursor>
Link copied to clipboard

Returns a specialized view of the keys of this associated container.

Link copied to clipboard
fun put(key: Int, value: Long): Long
Link copied to clipboard
Link copied to clipboard
fun putIfAbsent(key: Int, value: Long): Boolean

Trove-inspired API method. An equivalent of the following code:

Link copied to clipboard
fun putOrAdd(key: Int, putValue: Long, incrementValue: Long): Long

If key exists, putValue is inserted into the map, otherwise any existing value is incremented by additionValue.

Link copied to clipboard
open override fun ramBytesUsed(): Long

Return the memory usage of this object in bytes. Negative values are illegal.

Link copied to clipboard
fun release()
Link copied to clipboard
fun remove(key: Int): Long
Link copied to clipboard
fun size(): Int
Link copied to clipboard
open override fun toString(): String

Convert the contents of this map to a human-friendly string.

Link copied to clipboard