interface VariantMultiSet<T>
A type-variant immutable MultiSet of value type T. In the MultiSet, each value can occur multiple times. See the MultiSet documentation and the VariantMultiSet API documentation
Companion namespace: VariantMultiSet
Extends: VariantMultiSetBase<T,Tp>
Implemented by: VariantMultiSet.NonEmpty<T>
Type parameters
Name | Description |
---|---|
T | the value type |
Type-variance means that both the value type can be widened in a type-safe way without casting. @note As a consequence of being variant, the type does not contain methods that (can) add new elements to the collection.
Properties
countMap
Returns the Map representation of this collection.
countMap
isEmpty
Returns true if the collection is empty.
isEmpty
size
Returns the number of values in the collection.
size
sizeDistinct
Returns the number of distinct values in the collection.
sizeDistinct
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
.assumeNonEmpty
Returns the collection as a .NonEmpty type
assumeNonEmpty
count
Returns the amount of occurrances of the given value
in the collection.
count
value
in the collection.filterEntries
Returns the collection containing only those values for which the given pred
function returns true.
filterEntries
pred
function returns true.forEach
Performs given function f
for each value of the collection, using given state
as initial traversal state.
forEach
f
for each value of the collection, using given state
as initial traversal state.has
Returns true if the given value
exists in the collection.
has
value
exists 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
remove
Returns the collection where the given amount
(default: 'ALL') of the given value
are removed.
remove
amount
(default: 'ALL') of the given value
are removed.removeAllEvery
Returns the collection where for every value from given values
StreamSource
, all values in the collection are removed.
removeAllEvery
values
StreamSource
, all values in the collection are removed.removeAllSingle
Returns the collection where every single value from given values
StreamSource
is removed.
removeAllSingle
values
StreamSource
is removed.stream
Returns a Stream containing all values of this collection.
stream
streamDistinct
Returns a Stream containing all distinct values of this collection.
streamDistinct
toArray
Returns an array containing all values in this collection.
toArray
toJSON
Returns a JSON representation of this collection.
toJSON
toString
Returns a string representation of this collection.
toString