MapExtensions<K, V> extension
Common Map extensions
- on
-
- Map<
K, V>
- Map<
Methods
-
all(
bool predicate(K key, V value)) → bool -
Available on Map<
Returns true if all entries satisfy theK, V> , provided by the MapExtensions extensionpredicate. -
any(
bool predicate(K key, V value)) → bool -
Available on Map<
Returns true if any entry satisfies theK, V> , provided by the MapExtensions extensionpredicate. -
filterKeys(
bool predicate(K key)) → Map< K, V> -
Available on Map<
Filters the map based on a condition applied to its keys.K, V> , provided by the MapExtensions extension -
filterValues(
bool predicate(V value)) → Map< K, V> -
Available on Map<
Filters the map based on a condition applied to its values.K, V> , provided by the MapExtensions extension -
getOrDefault(
K key, V defaultValue) → V? -
Available on Map<
Retrieves the value for the specifiedK, V> , provided by the MapExtensions extensionkeyfrom the map. If the key does not exist, returns the provideddefaultValue. -
getOrNull(
K key) → V? -
Available on Map<
Retrieves the value for the specifiedK, V> , provided by the MapExtensions extensionkeyfrom the map. If the key does not exist, returns null. -
invert(
) → Map< V, K> -
Available on Map<
Inverts the map by swapping its keys and values. Assumes that the values are unique.K, V> , provided by the MapExtensions extension -
mapKeys<
K2> (K2 transform(K key, V value)) → Map< K2, V> -
Available on Map<
Transforms the keys of the map.K, V> , provided by the MapExtensions extension -
mapValues<
V2> (V2 transform(K key, V value)) → Map< K, V2> -
Available on Map<
Transforms the values of the map.K, V> , provided by the MapExtensions extension -
merge(
Map< K, V> other, V resolve(V v1, V v2)?) → Map<K, V> -
Available on Map<
Merges this map with anotherK, V> , provided by the MapExtensions extensionothermap. For duplicate keys,resolvedetermines the final value. -
omit(
Iterable< K> keys) → Map<K, V> -
Available on Map<
Returns a new map containing all entries except those for the givenK, V> , provided by the MapExtensions extensionkeys. -
pick(
Iterable< K> keys) → Map<K, V> -
Available on Map<
Returns a new map containing only the entries for the givenK, V> , provided by the MapExtensions extensionkeys. -
toJsonString(
) → String -
Available on Map<
Converts the map to a JSON string.K, V> , provided by the MapExtensions extension -
toJsonStringWithIndent(
[int spaces = 2]) → String -
Available on Map<
Converts the map to a formatted JSON string, with specified indentation.K, V> , provided by the MapExtensions extension