import { initContainer, IteratorType } from "../ContainerBase"; import { HashContainer, HashContainerIterator, HashLinkNode } from "./Base"; declare class HashMapIterator extends HashContainerIterator { readonly container: HashMap; constructor(node: HashLinkNode, header: HashLinkNode, container: HashMap, iteratorType?: IteratorType); get pointer(): [K, V]; copy(): HashMapIterator; equals(iter: HashMapIterator): boolean; } export type { HashMapIterator }; declare class HashMap extends HashContainer { constructor(container?: initContainer<[K, V]>); begin(): HashMapIterator; end(): HashMapIterator; rBegin(): HashMapIterator; rEnd(): HashMapIterator; front(): [K, V] | undefined; back(): [K, V] | undefined; /** * @description Insert a key-value pair or set value by the given key. * @param key - The key want to insert. * @param value - The value want to set. * @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.
* If a `undefined` value is passed in, the type will be automatically judged. * @returns The size of container after setting. */ setElement(key: K, value: V, isObject?: boolean): number; /** * @description Get the value of the element of the specified key. * @param key - The key want to search. * @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.
* If a `undefined` value is passed in, the type will be automatically judged. * @example * const val = container.getElementByKey(1); */ getElementByKey(key: K, isObject?: boolean): V | undefined; getElementByPos(pos: number): [K, V]; /** * @description Check key if exist in container. * @param key - The element you want to search. * @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.
* If a `undefined` value is passed in, the type will be automatically judged. * @returns An iterator pointing to the element if found, or super end if not found. */ find(key: K, isObject?: boolean): HashMapIterator; forEach(callback: (element: [K, V], index: number, hashMap: HashMap) => void): void; [Symbol.iterator](): Generator<[K, V], void, unknown>; } export default HashMap;