//================================================================ /** * @packageDocumentation * @module std.base */ //================================================================ import { MapContainer } from "./MapContainer"; import { IHashContainer } from "../../internal/container/associative/IHashContainer"; import { IPair } from "../../utility/IPair"; import { Entry } from "../../utility/Entry"; import { MapElementList } from "../../internal/container/associative/MapElementList"; /** * Common interface for hash maps. * * @template Key Key type * @template T Mapped type * @template Unique Whether duplicated key is blocked or not * @template Source Derived type extending this {@link IHashMap} * * @author Jeongho Nam - https://github.com/samchon */ export interface IHashMap< Key, T, Unique extends boolean, Source extends IHashMap, > extends MapContainer< Key, T, Unique, Source, IHashMap.Iterator, IHashMap.ReverseIterator >, IHashContainer< Key, Entry, Source, IHashMap.Iterator, IHashMap.ReverseIterator, IPair > { /* --------------------------------------------------------- ITERATORS --------------------------------------------------------- */ /** * @inheritDoc */ begin(): IHashMap.Iterator; /** * Iterator to the first element in a specific bucket. * * @param index Index number of the specific bucket. * @return Iterator from the specific bucket. */ begin(index: number): IHashMap.Iterator; /** * @inheritDoc */ end(): IHashMap.Iterator; /** * Iterator to the end in a specific bucket. * * @param index Index number of the specific bucket. * @return Iterator from the specific bucket. */ end(index: number): IHashMap.Iterator; } export namespace IHashMap { /** * Iterator of {@link IHashMap} * * @author Jenogho Nam */ export type Iterator< Key, T, Unique extends boolean, Source extends IHashMap, > = MapElementList.Iterator; /** * Reverse iterator of {@link IHashMap} * * @author Jenogho Nam */ export type ReverseIterator< Key, T, Unique extends boolean, Source extends IHashMap, > = MapElementList.ReverseIterator; }