Multiset<E> class
A generalized Set (or Bag) in which members are allowed to appear more than once.
- Inheritance
-
- Object
- IterableBase<
E> - Multiset
- Available extensions
- BiMapOnIterableExtension
- BitListExtension
- ChunkedIterableExtension
- CloseMatchesOnIterable
- CloseMatchesOnStringIterable
- CombinationsIterableExtension
- CompoundIterableComparator
- CountIterableExtension
- DeepFlattenIterableExtension
- EnumByName
- FlatMapIterableExtension
- FlattenIterableExtension
- FutureIterable
- GcdBigIntIterableExtension
- GcdIntegerIterableExtension
- GroupIterableExtension
- IndexedIterableExtension
- IndicesIterableExtension
- IterableExtensions
- LcmBigIntIterableExtension
- LcmIntegerIterableExtension
- ListMultimapOnIterableExtension
- MultisetExtension
- NullableIterableExtensions
- OperatorsIterableExtension
- PairwiseIterableExtension
- PartitionIterableExtension
- PermutationIterableExtension
- PolynomialIterableExtension
- PowerSetIterableExtension
- ProductIterableExtension
- RandomIterableExtension
- RepeatIterableExtension
- SeparatedIterableExtension
- SequencePrinterIterableExtension
- SetMultimapOnIterableExtension
- SortedListIterableExtension
- ToMapIterableExtension
- UniqueIterableExtension
- WindowIterableExtension
- ZipIterableExtension
Constructors
- Multiset()
-
Creates an empty Multiset.
factory
-
Multiset.from(Iterable<
E> other) -
Creates a Multiset that contains all elements of
other
.factory -
Multiset.fromIterable(Iterable<
Object?> iterable, {E key(Object? element)?, int count(Object? element)?}) -
Creates a Multiset where the elements and their occurrence count is
computed from an
iterable
.factory - Multiset.identity()
-
Creates an empty identity Multiset.
factory
-
Multiset.of(Iterable<
E> other) -
Creates a Multiset that contains all elements of
other
.factory
Properties
-
counts
→ Iterable<
int> -
Returns a view on the counts of the distinct elements of the receiver.
no setter
-
distinct
→ Iterable<
E> -
Returns a view on the distinct elements of the receiver.
no setter
- first → E
-
The first element.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
E> -
Iterator over the repeated elements of the receiver.
no setteroverride
- last → E
-
The last element.
no setterinherited
- length → int
-
Returns the total number of elements in the receiver.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → E
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
Methods
-
add(
E element, [int occurrences = 1]) → void -
Adds
element
to the receiveroccurrences
number of times. -
addAll(
Iterable< E> elements) → void -
Adds all of
elements
to the receiver. -
any(
bool test(E element)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
asMap(
) → Map< E, int> - Returns an unmodifiable view of the underlying data in a Map with the elements as the key and their counts as the value.
-
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
R
instances.inherited -
clear(
) → void - Removes all elements from the receiver.
-
combine(
Iterable< E> other, int callback(E element, int a, int b)) → Multiset<E> -
Returns a new Multiset by evaluating
callback
element-wise for each distinct element ofthis
andother
. -
contains(
Object? element) → bool -
Returns
true
ifelement
is in the receiver.override -
containsAll(
Iterable< Object?> other) → bool -
Returns
true
if all elements ofother
are contained in the receiver. -
difference(
Iterable< Object?> other) → Multiset<E> -
Returns a new Multiset with all the elements of the receiver that are
not in
other
. -
elementAt(
int index) → E -
Returns the
index
th element.inherited -
every(
bool test(E element)) → bool -
Checks whether every element of this iterable satisfies
test
.inherited -
expand<
T> (Iterable< T> toElements(E element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
firstWhere(
bool test(E element), {E orElse()?}) → E -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T previousValue, E element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< E> other) → Iterable<E> -
Creates the lazy concatenation of this iterable and
other
.inherited -
forEach(
void action(E element)) → void -
Invokes
action
on each element of this iterable in iteration order.inherited -
intersection(
Iterable< Object?> other) → Multiset<E> -
Returns a new Multiset with the elements that are in the receiver as
well as those in
other
. -
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastWhere(
bool test(E element), {E orElse()?}) → E -
The last element that satisfies the given predicate
test
.inherited -
map<
T> (T toElement(E e)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reduce(
E combine(E value, E element)) → E -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
remove(
Object? element, [int occurrences = 1]) → void -
Removes
element
from the receiveroccurrences
number of times. -
removeAll(
Iterable< Object?> elements) → void -
Removes each element of
elements
from the receiver. -
singleWhere(
bool test(E element), {E orElse()?}) → E -
The single element that satisfies
test
.inherited -
skip(
int count) → Iterable< E> -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(E value)) → Iterable< E> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
take(
int count) → Iterable< E> -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(E value)) → Iterable< E> -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
toList(
{bool growable = true}) → List< E> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< E> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
Returns a string representation of (some of) the elements of
this
.inherited -
union(
Iterable< E> other) → Multiset<E> -
Returns a new Multiset with all the elements of the receiver and those
in
other
. -
where(
bool test(E element)) → Iterable< E> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.inherited -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
Object? element) → int -
Gets the number of occurrences of an
element
. -
operator []=(
E element, int occurrences) → void -
Sets the number of
occurrences
of anelement
.