ListMultimap<K, V> class
A multimap implementation that uses Lists to store the values associated with each key.
- Implemented types
-
- Multimap<
K, V>
- Multimap<
Constructors
- ListMultimap()
- ListMultimap.fromIterable(Iterable iterable, {K key(dynamic)?, V value(dynamic)?})
- Constructs a new list-backed multimap.
-
ListMultimap.fromMultimap(Multimap<
K, V> other) -
Constructs a new multimap with the same values as
other
.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Returns true if there is no key in the multimap.
no setterinherited
- isNotEmpty → bool
-
Returns true if there is at least one key in the multimap.
no setterinherited
-
keys
→ Iterable<
K> -
The keys of
this
.no setterinherited - length → int
-
The number of keys in the multimap.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
values
→ Iterable<
V> -
The values of
this
.no setterinherited
Methods
-
add(
K key, V value) → void -
Adds an association from the given key to the given value.
inherited
-
addAll(
Multimap< K, V> other) → void -
Adds all associations of
other
to this multimap.inherited -
addValues(
K key, Iterable< V> values) → void -
Adds an association from the given key to each of the given values.
inherited
-
asMap(
) → Map< K, List< V> > -
Returns a view of this multimap as a map.
override
-
clear(
) → void -
Removes all data from the multimap.
inherited
-
contains(
Object? key, Object? value) → bool -
Returns whether this multimap contains the given association between
key
andvalue
.inherited -
containsKey(
Object? key) → bool -
Returns whether this multimap contains the given
key
.inherited -
containsValue(
Object? value) → bool -
Returns whether this multimap contains the given
value
.inherited -
forEach(
void f(K key, V value)) → void -
Applies
f
to each {key, value} pair of the multimap.inherited -
forEachKey(
void f(K key, List< V> value)) → void -
Applies
f
to each {key,Iterable<value>
} pair of the multimap.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
Object? key, V? value) → bool -
Removes the association between the given
key
andvalue
. Returnstrue
if the association existed,false
otherwise.inherited -
removeAll(
Object? key) → List< V> -
Removes the association for the given
key
. Returns the collection of removed values, or an empty iterable ifkey
was unmapped. -
removeWhere(
bool predicate(K key, V value)) → void -
Removes all entries of this multimap that satisfy the given
predicate
.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
Object? key) → List< V> -
Returns the values for the given
key
. An empty iterable is returned ifkey
is not mapped. The returned collection is a view on the multimap. Updates to the collection modify the multimap and likewise, modifications to the multimap are reflected in the returned collection.