Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HashMap<Key, T>

Unique-key Map based on Hash buckets.

author

Jeongho Nam - https://github.com/samchon

Type parameters

  • Key

  • T

Hierarchy

Implements

Index

Type aliases

Static Iterator

Iterator<Key, T, SourceT, IteratorT, ReverseT, Key, T>: Iterator<Key, T, true, HashMap<Key, T>>

Iterator of UniqueMap Iterator of HashMap

author

Jenogho Nam http://samchon.org

Type parameters

  • Key

  • T

  • SourceT: UniqueMap<Key, T, SourceT, IteratorT, ReverseT>

  • IteratorT: Iterator<Key, T, SourceT, IteratorT, ReverseT>

  • ReverseT: ReverseIterator<Key, T, SourceT, IteratorT, ReverseT>

  • Key

  • T

Static ReverseIterator

ReverseIterator<Key, T, SourceT, IteratorT, ReverseT, Key, T>: ReverseIterator<Key, T, true, HashMap<Key, T>>

Reverse iterator of UniqueMap Reverse iterator of HashMap

author

Jenogho Nam http://samchon.org

Type parameters

  • Key

  • T

  • SourceT: UniqueMap<Key, T, SourceT, IteratorT, ReverseT>

  • IteratorT: Iterator<Key, T, SourceT, IteratorT, ReverseT>

  • ReverseT: ReverseIterator<Key, T, SourceT, IteratorT, ReverseT>

  • Key

  • T

Constructors

constructor

Methods

[Symbol.iterator]

  • [Symbol.iterator](): IterableIterator<Entry<Key, T>>

assign

  • assign<InputIterator>(first: InputIterator, last: InputIterator): void

begin

bucket

  • bucket(key: Key): number

bucket_count

  • bucket_count(): number

bucket_size

  • bucket_size(index: number): number

clear

  • clear(): void

count

  • count(key: Key): number

emplace

  • emplace(key: Key, val: T): Pair<Iterator<Key, T>, boolean>

emplace_hint

empty

  • empty(): boolean

end

erase

extract

find

get

  • get(key: Key): T

has

  • has(key: Key): boolean

hash_function

  • hash_function(): Hasher<Key>

insert

  • insert(pair: IPair<Key, T>): Pair<Iterator<Key, T>, boolean>
  • insert(hint: Iterator<Key, T>, pair: IPair<Key, T>): Iterator<Key, T>
  • insert<InputIterator>(first: InputIterator, last: InputIterator): void
  • Insert an element.

    Parameters

    • pair: IPair<Key, T>

      A tuple to be referenced for the insert.

    Returns Pair<Iterator<Key, T>, boolean>

    Pair of an iterator to the newly inserted element and true, if the specified key doesn't exist, otherwise Pair of iterator to the ordinary element and false.

  • Insert an element with hint.

    Parameters

    • hint: Iterator<Key, T>

      Hint for the position where the element can be inserted.

    • pair: IPair<Key, T>

      A tuple to be referenced for the insert.

    Returns Iterator<Key, T>

    An iterator to the newly inserted element, if the specified key doesn't exist, otherwise an iterator to the ordinary element.

  • Insert range elements.

    Type parameters

    Parameters

    • first: InputIterator

      Input iterator of the first position.

    • last: InputIterator

      Input iteartor of the last position.

    Returns void

insert_or_assign

  • insert_or_assign(key: Key, value: T): Pair<Iterator<Key, T>, boolean>
  • insert_or_assign(hint: Iterator<Key, T>, key: Key, value: T): Iterator<Key, T>
  • Insert or assign an element.

    Parameters

    • key: Key

      Key to be mapped or search for.

    • value: T

      Value to insert or assign.

    Returns Pair<Iterator<Key, T>, boolean>

    Pair of an iterator to the newly inserted element and true, if the specified key doesn't exist, otherwise Pair of iterator to the ordinary element and false.

  • Insert or assign an element with hint.

    Parameters

    • hint: Iterator<Key, T>

      Hint for the position where the element can be inserted.

    • key: Key

      Key to be mapped or search for.

    • value: T

      Value to insert or assign.

    Returns Iterator<Key, T>

    An iterator to the newly inserted element, if the specified key doesn't exist, otherwise an iterator to the ordinary element.

key_eq

  • key_eq(): BinaryPredicator<Key>

load_factor

  • load_factor(): number

max_load_factor

  • max_load_factor(): number
  • max_load_factor(z: number): void

merge

  • merge(source: HashMap<Key, T>): void

push

  • push(...items: IPair<Key, T>[]): number

rbegin

rehash

  • rehash(n: number): void

rend

reserve

  • reserve(n: number): void

set

  • set(key: Key, val: T): void

size

  • size(): number

swap

toJSON

  • toJSON(): Array<Entry<Key, T>>

Generated using TypeDoc