interface OrderedHashMap.NonEmpty<K,V>
A non-empty type-invariant immutable Ordered HashMap of key type K, and value type V. In the Map, each key has exactly one value, and the Map cannot contain duplicate keys. See the Map documentation and the OrderedHashMap API documentation
Extends: Streamable.NonEmpty<T>
, OrderedHashMap<K,V>
Type parameters
Name | Description |
---|---|
K | the key type |
V | the value type |
note
- The OrderedHashMap keeps maintains the insertion order of elements, thus iterators and streams will also reflect this order. - The OrderedHashMap wraps around a HashMap instance, thus has mostly the same time complexity as the HashMap. - The OrderedHashMap keeps the key insertion order in a List, thus its space complexity is higher than a regular HashMap.
example
const m1 = OrderedHashMap.empty<number, string>()
const m2 = OrderedHashMap.of([1, 'a'], [2, 'b'])
Methods
stream
undocumented
stream