@cute-dw/core
Version:
This TypeScript library is the main part of a more powerfull package designed for the fast WEB software development. The cornerstone of the library is the **DataStore** class, which might be useful when you need a full control of the data, but do not need
23 lines (22 loc) • 1.49 kB
TypeScript
import { SortedMap } from "./SortedMap";
/**
* A `SortedMap` extended with navigation methods returning the closest matches for given search targets.
*/
export interface NavigableMap<K, V> extends SortedMap<K, V> {
/** Returns the least key greater than or equal to the given key, or _undefined_ if there is no such key */
ceilingKey(key: K): K | undefined;
/** Returns a key-value mapping associated with the least key in this map, or _undefined_ if the map is empty */
firstEntry(): [K, V] | undefined;
/** Returns the greatest key less than or equal to the given key, or _undefined_ if there is no such key */
floorKey(key: K): K | undefined;
/** Returns the least key strictly greater than the given key, or _undefined_ if there is no such key */
higherKey(key: K): K | undefined;
/** Returns a key-value mapping associated with the greatest key in this map, or _undefined_ if the map is empty */
lastEntry(): [K, V] | undefined;
/** Returns the greatest key strictly less than the given key, or _undefined_ if there is no such key */
lowerKey(key: K): K | undefined;
/** Removes and returns a key-value mapping associated with the least key in this map, or _undefined_ if the map is empty */
pollFirstEntry(): [K, V] | undefined;
/** Removes and returns a key-value mapping associated with the greatest key in this map, or _undefined_ if the map is empty */
pollLastEntry(): [K, V] | undefined;
}