Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HashSet<Key>

Unique-key Set based on Hash buckets.

author

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

Type parameters

  • Key

Hierarchy

Implements

Index

Type aliases

Static Iterator

Iterator<Key, SourceT, IteratorT, ReverseT, Key>: Iterator<Key, true, HashSet<Key>>

Iterator of UniqueSet Iterator of HashSet

author

Jenogho Nam http://samchon.org

Type parameters

  • Key

  • SourceT: UniqueSet<Key, SourceT, IteratorT, ReverseT>

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

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

  • Key

Static ReverseIterator

ReverseIterator<Key, SourceT, IteratorT, ReverseT, Key>: ReverseIterator<Key, true, HashSet<Key>>

Reverse iterator of UniqueSet Reverse iterator of HashSet

author

Jenogho Nam http://samchon.org

Type parameters

  • Key

  • SourceT: UniqueSet<Key, SourceT, IteratorT, ReverseT>

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

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

  • Key

Constructors

constructor

  • new HashSet(hash?: Hasher<Key>, equal?: BinaryPredicator<Key>): HashSet
  • new HashSet(items: Key[], hash?: Hasher<Key>, equal?: BinaryPredicator<Key>): HashSet
  • new HashSet(obj: HashSet<Key>): HashSet
  • new HashSet(first: Readonly<IForwardIterator<Key>>, last: Readonly<IForwardIterator<Key>>, hash?: Hasher<Key>, equal?: BinaryPredicator<Key>): HashSet

Methods

[Symbol.iterator]

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

assign

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

begin

bucket

  • bucket(key: Key): number

bucket_count

  • bucket_count(): number

bucket_size

  • bucket_size(n: number): number

clear

  • clear(): void

count

  • count(key: Key): number

empty

  • empty(): boolean

end

erase

extract

find

has

  • has(key: Key): boolean

hash_function

  • hash_function(): Hasher<Key>

insert

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

    Parameters

    • key: Key

      Key to insert.

    Returns Pair<Iterator<Key>, boolean>

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

  • Insert an element with hint.

    Parameters

    • hint: Iterator<Key>

      Hint for the position where the element can be inserted.

    • key: Key

    Returns Iterator<Key>

    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

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: HashSet<Key>): void

push

  • push(...items: Key[]): number

rbegin

rehash

  • rehash(n: number): void

rend

reserve

  • reserve(n: number): void

size

  • size(): number

swap

toJSON

  • toJSON(): Array<Key>

Generated using TypeDoc