KtMapExtensions<K, V> extension

on

Properties

dart Map<K, V>
Returns a read-only dart:core Map [...]
read-only

Methods

all(bool predicate(K key, V value)) bool
Returns true if all entries match the given predicate. predicate must not be null.
any(bool predicate(K key, V value)) bool
Returns true if there is at least one entry that matches the given predicate. predicate must not be null.
count([bool predicate(KtMapEntry<K, V>)]) int
Returns the number of entries matching the given predicate or the number of entries when predicate = null.
filter(bool predicate(KtMapEntry<K, V> entry)) KtMap<K, V>
Returns a new map containing all key-value pairs matching the given predicate. [...]
filterKeys(bool predicate(K)) KtMap<K, V>
Returns a map containing all key-value pairs with keys matching the given predicate. [...]
filterNot(bool predicate(KtMapEntry<K, V> entry)) KtMap<K, V>
Returns a new map containing all key-value pairs not matching the given predicate. [...]
filterNotTo<M extends KtMutableMap>(M destination, bool predicate(KtMapEntry<K, V> entry)) → M
Appends all entries not matching the given predicate into the given destination. [...]
filterTo<M extends KtMutableMap>(M destination, bool predicate(KtMapEntry<K, V> entry)) → M
Appends all entries matching the given predicate into the mutable map given as destination parameter. [...]
filterValues(bool predicate(V)) KtMap<K, V>
Returns a map containing all key-value pairs with values matching the given predicate. [...]
forEach(dynamic action(K key, V value)) → void
Performs given action on each key/value pair from this map. [...]
getOrElse(K key, V defaultValue()) → V
Returns the value for the given key, or the result of the defaultValue function if there was no entry for the given key.
getValue(K key) → V
Returns the value for the given key or throws an exception if there is no such key in the map. [...]
@nonNull
ifEmpty<R extends KtMap<K, V>>(R defaultValue()) → R
Returns this map if it's not empty or the result of calling defaultValue function if the map is empty.
isNotEmpty() bool
Returns true if this map is not empty.
iterator() KtIterator<KtMapEntry<K, V>>
Returns an Iterator over the entries in the Map.
map<R>(R transform(KtMapEntry<K, V> entry)) KtList<R>
Returns a list containing the results of applying the given transform function to each entry in the original map.
mapKeys<R>(R transform(KtMapEntry<K, V>)) KtMap<R, V>
Returns a new Map with entries having the keys obtained by applying the transform function to each entry in this Map and the values of this map. [...]
mapKeysTo<R, M extends KtMutableMap>(M destination, R transform(KtMapEntry<K, V> entry)) → M
Populates the given destination map with entries having the keys obtained by applying the transform function to each entry in this Map and the values of this map. [...]
mapTo<R, M extends KtMutableCollection>(M destination, R transform(KtMapEntry<K, V> entry)) → M
Applies the given transform function to each entry of the original map and appends the results to the given destination.
mapValues<R>(R transform(KtMapEntry<K, V>)) KtMap<K, R>
Returns a new map with entries having the keys of this map and the values obtained by applying the transform function to each entry in this Map. [...]
mapValuesTo<R, M extends KtMutableMap>(M destination, R transform(KtMapEntry<K, V> entry)) → M
Populates the given destination map with entries having the keys of this map and the values obtained by applying the transform function to each entry in this Map. [...]
maxBy<R extends Comparable>(R selector(KtMapEntry<K, V>)) KtMapEntry<K, V>
Returns the first entry yielding the largest value of the given function or null if there are no entries.
@nullable
maxWith(Comparator<KtMapEntry<K, V>> comparator) KtMapEntry<K, V>
Returns the first entry having the largest value according to the provided comparator or null if there are no entries.
@nullable
minBy<R extends Comparable>(R selector(KtMapEntry<K, V>)) KtMapEntry<K, V>
Returns the first entry yielding the smallest value of the given function or null if there are no entries.
@nullable
minus(K key) KtMap<K, V>
Returns a map containing all entries of the original map except the entry with the given key. [...]
minWith(Comparator<KtMapEntry<K, V>> comparator) KtMapEntry<K, V>
Returns the first entry having the smallest value according to the provided comparator or null if there are no entries.
@nullable
none(bool predicate(K key, V value)) bool
Returns true if there is no entries in the map that match the given predicate. predicate must not be null.
plus(KtMap<K, V> map) KtMap<K, V>
Creates a new read-only map by replacing or adding entries to this map from another map. [...]
toList() KtList<KtPair<K, V>>
Returns a KtList containing all key-value pairs.
toMap() KtMap<K, V>
Returns a new read-only map containing all key-value pairs from the original map. [...]
toMutableMap() KtMutableMap<K, V>
Returns a new mutable map containing all key-value pairs from the original map. [...]

Operators

operator +(KtMap<K, V> map) KtMap<K, V>
Creates a new read-only map by replacing or adding entries to this map from another map. [...]
operator -(K key) KtMap<K, V>
Returns a map containing all entries of the original map except the entry with the given key. [...]