Skip to main content
Module

x/rimbu/mod.ts>BiMap.NonEmpty

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface BiMap.NonEmpty
implements BiMap<K, V>, [Streamable.NonEmpty]<readonly [K, V]>
import { type BiMap } from "https://deno.land/x/rimbu@0.13.1/mod.ts";
const { NonEmpty } = BiMap;

A non-empty type-invariant immutable bi-directional Map where keys and values have a one-to-one mapping. See the BiMap documentation and the BiMap API documentation * @typeparam K - the key type

Properties

readonly
isEmpty: false

Returns false since this collection is known to be non-empty.

readonly
keyValueMap: RMap.NonEmpty<K, V>

Returns the non-empty Map representation of the key to value mapping.

readonly
valueKeyMap: RMap.NonEmpty<V, K>

Returns the non-empty Map representation of the key to value mapping.

Methods

nonEmpty(): true

Returns true since this collection is known to be non-empty

assumeNonEmpty(): this

Returns a self reference since this collection is known to be non-empty.

asNormal(): BiMap<K, V>

Returns this collection typed as a 'possibly empty' collection.

addEntries(entries: StreamSource<readonly [K, V]>): BiMap.NonEmpty<K, V>

Returns the collection with the entries from the given StreamSource entries added.

updateValueAtKey<UK = K>(key: RelatedTo<K, UK>, valueUpdate: Update<V>): BiMap.NonEmpty<K, V>

Returns the collection where the value associated with given key is updated with the given update value or update function.

updateKeyAtValue<UV = V>(keyUpdate: Update<K>, value: RelatedTo<V, UV>): BiMap.NonEmpty<K, V>

Returns the collection where the key associated with given value is updated with the given update value or update function.

stream(): Stream.NonEmpty<readonly [K, V]>

Returns a non-empty Stream containing all entries of this collection as tuples of key and value.

streamKeys(): Stream.NonEmpty<K>

Returns a non-empty Stream containing all keys of this collection.

streamValues(): Stream.NonEmpty<V>

Returns a non-empty Stream containing all values of this collection.

toArray(): ArrayNonEmpty<readonly [K, V]>

Returns a non-empty array containing all entries in this collection.