MapExtensions<K, V> extension
Extensions for Map operations and utilities.
- on
-
- Map<
K, V>
- Map<
Properties
-
firstEntry
→ MapEntry<
K, V> ? -
Available on Map<
Returns the first key-value pair, orK, V> , provided by the MapExtensions extensionnullif the map is empty.no setter - isNotEmpty → bool
-
Available on Map<
ReturnsK, V> , provided by the MapExtensions extensiontrueif the map is not empty.no setter -
lastEntry
→ MapEntry<
K, V> ? -
Available on Map<
Returns the last key-value pair, orK, V> , provided by the MapExtensions extensionnullif the map is empty.no setter
Methods
-
all(
bool test(K, V)) → bool -
Available on Map<
ReturnsK, V> , provided by the MapExtensions extensiontrueif all entries match the predicate. -
any(
bool test(K, V)) → bool -
Available on Map<
ReturnsK, V> , provided by the MapExtensions extensiontrueif the map contains any entry matching the predicate. -
filter(
bool test(K, V)) → Map< K, V> -
Available on Map<
Filters the map by a predicate.K, V> , provided by the MapExtensions extension -
getOrDefault(
K key, V defaultValue) → V -
Available on Map<
Returns the value for the key or a default value.K, V> , provided by the MapExtensions extension -
getOrNull(
K key) → V? -
Available on Map<
Returns the value for the key orK, V> , provided by the MapExtensions extensionnullif not found. -
getOrPut(
K key, V defaultValue()) → V -
Available on Map<
Returns the value for the key or computes it if not found.K, V> , provided by the MapExtensions extension -
invert(
) → Map< V, K> -
Available on Map<
Inverts the map, swapping keys and values.K, V> , provided by the MapExtensions extension -
keysWhere(
bool test(K, V)) → List< K> -
Available on Map<
Returns a list of keys that match the predicate.K, V> , provided by the MapExtensions extension -
mapEntries<
K2, V2> (MapEntry< K2, V2> transform(K key, V value)) → Map<K2, V2> -
Available on Map<
Maps the map to a new map with transformed keys and values.K, V> , provided by the MapExtensions extension -
mapKeys<
K2> (K2 mapper(K)) → Map< K2, V> -
Available on Map<
Returns a new map with keys transformed by the mapper function.K, V> , provided by the MapExtensions extension -
mapValues<
V2> (V2 mapper(V)) → Map< K, V2> -
Available on Map<
Returns a new map with values transformed by the mapper function.K, V> , provided by the MapExtensions extension -
merge(
Map< K, V> other) → Map<K, V> -
Available on Map<
Merges this map with another map.K, V> , provided by the MapExtensions extension -
mergeWith(
Map< K, V> other, V mergeFunction(V, V)) → Map<K, V> -
Available on Map<
Merges this map with another map using a merge function for conflicts.K, V> , provided by the MapExtensions extension -
removeWhere(
bool test(K, V)) → void -
Available on Map<
Removes entries that match the predicate.K, V> , provided by the MapExtensions extension -
sortedByKey(
[int compare(K, K)?]) → Map< K, V> -
Available on Map<
Returns a new map sorted by keys.K, V> , provided by the MapExtensions extension -
sortedByValue(
[int compare(V, V)?]) → Map< K, V> -
Available on Map<
Returns a new map sorted by values.K, V> , provided by the MapExtensions extension -
valuesWhere(
bool test(K, V)) → List< V> -
Available on Map<
Returns a list of values that match the predicate.K, V> , provided by the MapExtensions extension