CharObjectHashMap

open class CharObjectHashMap<VType> @JvmOverloads constructor(expectedElements: Int, loadFactor: Double = DEFAULT_LOAD_FACTOR.toDouble()) : Iterable<CharObjectHashMap.CharObjectCursor<VType>> , Accountable, Cloneable<CharObjectHashMap<VType>>

A hash map of char to Object, implemented using open addressing with linear probing for collision resolution. Supports null values.

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

github: https://github.com/carrotsearch/hppc release 0.10.0

Constructors

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

New instance with sane defaults.

constructor(map: CharObjectHashMap<VType?>)

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

Types

Link copied to clipboard

Forked from HPPC, holding int index,key and value

Link copied to clipboard
object Companion
Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard

The number of stored keys (assigned key slots), excluding the special "empty" key, if any (use .size instead).

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

Special treatment for the "empty slot" key marker.

Link copied to clipboard
Link copied to clipboard

The array holding keys.

Link copied to clipboard
var mask: Int

Mask for slot scans in .keys.

Link copied to clipboard
var values: Array<Any?>?

The array holding values.

Functions

Link copied to clipboard
fun clear()
Link copied to clipboard
open override fun clone(): CharObjectHashMap<VType>
Link copied to clipboard
Link copied to clipboard
fun ensureCapacity(expectedElements: Int)
Link copied to clipboard
open operator override fun equals(obj: Any?): Boolean
Link copied to clipboard
operator fun get(key: Char): VType?
Link copied to clipboard
fun getOrDefault(key: Char, defaultValue: VType?): VType?
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): VType?
Link copied to clipboard
fun indexInsert(index: Int, key: Char, value: VType?)
Link copied to clipboard
fun indexOf(key: Char): Int
Link copied to clipboard
fun indexRemove(index: Int): VType?
Link copied to clipboard
fun indexReplace(index: Int, newValue: VType?): VType?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun put(key: Char, value: VType?): VType?
Link copied to clipboard
Link copied to clipboard
fun putIfAbsent(key: Char, value: VType?): Boolean
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: Char): VType?
Link copied to clipboard
fun size(): Int
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard