CharArrayMap

A simple class that stores key Strings as char[]'s in a hash table. Note that this is not a general purpose class. For example, it cannot remove items from the map, nor does it resize its hash table to be smaller, etc. It is designed to be quick to retrieve items by char[] keys without the necessity of converting to a String first.

Constructors

Link copied to clipboard
constructor(startSize: Int, ignoreCase: Boolean)

Create map with enough capacity to hold startSize terms

constructor(c: Map<Any, V>, ignoreCase: Boolean)

Creates a map from the mappings in another map.

Types

Link copied to clipboard
object Companion
Link copied to clipboard

public iterator class so efficient methods are exposed to users

Link copied to clipboard

public EntrySet class so efficient methods are exposed to users

Properties

Link copied to clipboard
Link copied to clipboard
open override val keys: MutableSet<Any>
Link copied to clipboard
Link copied to clipboard

Returns an CharArraySet view on the map's keys. The set will use the same matchVersion as this map.

Link copied to clipboard
open override val size: Int
Link copied to clipboard
open override val values: MutableCollection<V>
Link copied to clipboard

Functions

Link copied to clipboard
open override fun clear()

Clears all entries in this map. This method is supported for reusing, but not Map.remove.

Link copied to clipboard
fun <K, V> MutableMap<K, V>.computeIfAbsent(key: K, mappingFunction: (K) -> V): V?

ported from java.util.Map.computeIfAbsent()

Link copied to clipboard
open override fun containsKey(o: Any): Boolean

true if the CharSequence is in the .keySet

open fun containsKey(text: CharArray, off: Int, len: Int): Boolean

true if the len chars of text starting at off are in the .keySet

Link copied to clipboard
open override fun containsValue(value: V): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open operator override fun get(o: Any): V?

open fun get(cs: CharSequence): V?

returns the value of the mapping of the chars inside this CharSequence

open fun get(text: CharArray, off: Int, len: Int): V?

returns the value of the mapping of len chars of text starting at off

Link copied to clipboard
expect open override fun isEmpty(): Boolean
Link copied to clipboard
Link copied to clipboard
open override fun put(o: Any, value: V): V?
open fun put(text: String, value: V): V?

Add the given mapping.

Link copied to clipboard
open override fun putAll(from: Map<out Any, V>)
Link copied to clipboard
open fun putCharArray(text: CharArray, value: V?): V?

Add the given mapping. If ignoreCase is true for this Set, the text array will be directly modified. The user should never modify this text array after calling this method.

Link copied to clipboard
fun <K, V> MutableMap<K, V>.putIfAbsent(key: K, value: V): V?

ported from java.util.Map.putIfAbsent()

Link copied to clipboard
open override fun remove(key: Any): V?
Link copied to clipboard
fun <K, V> MutableMap<K, V>.remove(key: K, value: V): Boolean

ported from java.util.Map.remove()

Link copied to clipboard
fun <K, V> MutableMap<K, V>.replace(key: K, value: V): V?

ported from java.util.Map.replace()

Link copied to clipboard
open override fun toString(): String