@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
36 lines (35 loc) • 1.95 kB
TypeScript
/**
* An object that maps keys to values. In any one `Dictionary` object, every key is associated with at most one value.
* Given a `Dictionary` and a key, the associated element can be looked up. Any non-null and non-undefined object can be used as
* a key and as a value.
*/
export interface Dictionary<K, V> {
/** Returns the number of entries (distinct keys) in this dictionary */
get size(): number;
/** Removes all the mappings from this dictionary */
clear(): void;
/** Returns _true_ if this dictionary contains a mapping for the specified `key` */
has(key: K): boolean;
/** Returns _true_ if this dictionary contains a mapping for the specified `key` */
containsKey(key: K): boolean;
/** Returns _true_ if this dictionary maps one or more keys to the specified `value` */
containsValue(value: V): boolean;
/** Returns the value to which the `key` is mapped in this dictionary */
get(key: K): V | undefined;
/** Returns the value to which the `key` is mapped in this dictionary, or `defaultValue` if this map contains no mapping for the key */
getOrDefault(key: K, defaultValue: V): V;
/** Tests if this dictionary maps no keys to value */
isEmpty(): boolean;
/** Returns an array of the keys in this dictionary */
keys(): Array<K>;
/** Returns a Set view of the keys contained in this dictionary */
keySet(): Set<K>;
/** Maps the specified `key` to the specified `value` in this dictionary and returns previous value of the mapping */
put(key: K, value: V): V | undefined;
/** Copies all the mappings from the specified source map to this dictionary */
putAll(map: Map<K, V> | Dictionary<K, V>): void;
/** Removes the `key` (and its corresponding value) from this dictionary */
remove(key: K): V | undefined;
/** Returns an array of the values in this dictionary */
values(): Array<V>;
}