interface HashBiMultiMap<K,V>
A type-invariant immutable bi-directional MultiMap where keys and values have a many-to-many mapping. Its keys and values are hashed. See the BiMultiMap documentation and the HashBiMultiMap API documentation
Companion namespace: HashBiMultiMap
Extends: BiMultiMapBase<K,V,Tp>
Implemented by: HashBiMultiMap.NonEmpty<K,V>
Type parameters
Name | Description |
---|---|
K | the key type |
V | the value type |
const h1 = HashBiMultiMap.empty<number, string>()
const h1 = HashBiMultiMap.of([1, 'a'], [1, 'b'])
Properties
context
Returns the context
associated to this collection instance.
context
context
associated to this collection instance.isEmpty
Returns false since this collection is known to be non-empty.
isEmpty
keySize
Returns the number of keys
keySize
keyValueMultiMap
Returns the MultiMap representation of the key to value mapping.
keyValueMultiMap
size
Returns the number of entries
size
valueKeyMultiMap
Returns the MultiMap representation of the value to key mapping.
valueKeyMultiMap
Methods
[Symbol.iterator]
Returns a FastIterator
instance used to iterate over the values of this Iterable
.
[Symbol.iterator]
FastIterator
instance used to iterate over the values of this Iterable
.add
Returns the collection with the given key
associated to the given value
.
add
key
associated to the given value
.addEntries
Returns the collection with the entries from the given StreamSource
entries
added.
addEntries
StreamSource
entries
added.assumeNonEmpty
Returns the collection as a .NonEmpty type
assumeNonEmpty
filter
Returns a collection containing only those entries that satisfy given pred
predicate.
filter
pred
predicate.forEach
Performs given function f
for each entry of the collection, using given state
as initial traversal state.
forEach
f
for each entry of the collection, using given state
as initial traversal state.getKeys
Returns a collection containing the keys associated with the given value
.
getKeys
value
.getValues
Returns a collection containing the values associated with the given key
.
getValues
key
.hasEntry
Returns true if the given key and value entry is in the collection.
hasEntry
hasKey
Returns true if the given key
is present in the collection.
hasKey
key
is present in the collection.hasValue
Returns true if the given value
is present in the collection.
hasValue
value
is present in the collection.nonEmpty
Returns true if there is at least one entry in the collection, and instructs the compiler to treat the collection as a .NonEmpty type.
nonEmpty
removeEntries
Returns the collection where the entries in the given entries
StreamSource are removed if present.
removeEntries
entries
StreamSource are removed if present.removeEntry
Returns the collection where the entry with given key
or value
is removed if present.
removeEntry
key
or value
is removed if present.removeKey
Returns the collection where the entries associated with given key
are removed if it was part of the collection.
removeKey
key
are removed if it was part of the collection.removeKeys
Returns the collection where the entries associated with each key in given keys
are removed if they were present.
removeKeys
keys
are removed if they were present.removeValue
Returns the collection where the entries associated with given value
are removed if it was part of the collection.
removeValue
value
are removed if it was part of the collection.removeValues
Returns the collection where the entries associated with each value in given values
are removed if they were present.
removeValues
values
are removed if they were present.setKeys
Returns the collection with the keys from the given keys
StreamSource associated with the given value
.
setKeys
keys
StreamSource associated with the given value
.setValues
Returns the collection with the values from the given values
StreamSource associated with the given key
.
setValues
values
StreamSource associated with the given key
.stream
Returns a Stream
containing all entries of this collection as tuples of key and value.
stream
Stream
containing all entries of this collection as tuples of key and value.streamKeys
Returns a Stream
containing all keys of this collection.
streamKeys
Stream
containing all keys of this collection.streamValues
Returns a Stream
containing all values of this collection.
streamValues
Stream
containing all values of this collection.toArray
Returns an array containing all entries in this collection.
toArray
toBuilder
Returns a builder object containing the entries of this collection.
toBuilder
toJSON
Returns a JSON representation of this collection.
toJSON
toString
Returns a string representation of this collection.
toString