IMapConst<K, V> class

This is an IMap which can be made constant. Note: Don't ever use it without the "const" keyword, because it will be unsafe.

Inheritance
Available Extensions
Annotations

Constructors

IMapConst(Map<K, V> _map, [ConfigMap config = const ConfigMap()])
To create an empty constant IMap: const IMapConst({}). To create a constant map with entries: const IMapConst({1:'a', 2:'b', 3:'c'}).
const

Properties

comparableEntries Iterable<Entry<K, V>>
Returns an Iterable of the map entries of type Entry. Contrary to MapEntry, Entry is comparable and implements equals (==) and hashcode by using its key and value.
no setterinherited
config ConfigMap
final
entries Iterable<MapEntry<K, V>>
Returns an Iterable of the map entries of type MapEntry.
no setterinherited
flush IMapConst<K, V>
Nothing happens when you flush a constant map, by definition.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
isDeepEquals bool
See also: ConfigList
no setterinherited
isEmpty bool
Returns true if there are no elements in this collection.
no setterinherited
isFlushed bool
A constant map is always flushed, by definition.
no setteroverride
isIdentityEquals bool
See also: ConfigList
no setterinherited
isNotEmpty bool
Returns true if there is at least one element in this collection.
no setterinherited
iterator Iterator<MapEntry<K, V>>
Returns a new Iterator that allows iterating the entries of the IMap.
no setterinherited
keys Iterable<K>
Returns an Iterable of the map keys.
no setterinherited
length int
The number of objects in this list.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unlock Map<K, V>
Unlocks the map, returning a regular (mutable, ordered) Map of type LinkedHashMap. This map is "safe", in the sense that is independent from the original IMap.
no setterinherited
unlockLazy Map<K, V>
Unlocks the map, returning a safe, modifiable (mutable) Map.
no setterinherited
unlockSorted Map<K, V>
Unlocks the map, returning a regular, mutable, ordered, sorted, Map of type LinkedHashMap. This map is "safe", in the sense that is independent from the original IMap.
no setterinherited
unlockView Map<K, V>
Unlocks the map, returning a safe, unmodifiable (immutable) Map view. The word "view" means the set is backed by the original IMap.
no setterinherited
values Iterable<V>
Returns an Iterable of the map values, in the same order as the keys. If you need to sort the values, please use toValueIList.
no setterinherited
withDeepEquals IMap<K, V>
Creates a map with deepEquals (compares all map entries by equality).
no setterinherited
withIdentityEquals IMap<K, V>
Creates a map with identityEquals (compares the internals by identity).
no setterinherited

Methods

add(K key, V value) IMap<K, V>
Returns a new map containing the current map plus the given key:value. (if necessary, the given key:value pair will override the current).
inherited
addAll(IMap<K, V> imap, {bool keepOrder = false}) IMap<K, V>
Returns a new map containing the current map plus the ones in the given imap.
inherited
addEntries(Iterable<MapEntry<K, V>> entries) IMap<K, V>
Returns a new map containing the current map plus the given entries. Note: entries that already exist in the original map will overwrite those of the original map, in place (keeping order).
inherited
addEntry(MapEntry<K, V> entry) IMap<K, V>
Returns a new map containing the current map plus the given key:value. (if necessary, the given entry will override the current one).
inherited
addMap(Map<K, V> map) IMap<K, V>
Returns a new map containing the current map plus the given map entries. Note: map entries that already exist in the original map will overwrite those of the original map, in place (keeping order).
inherited
any(bool test(K key, V value)) bool
Checks whether any key-value pair of this map satisfies test.
inherited
anyEntry(bool test(MapEntry<K, V>)) bool
Checks whether any entry of this iterable satisfies test.
inherited
cast<RK, RV>() IMap<RK, RV>
Provides a view of this map as having RK keys and RV instances, if necessary.
inherited
clear() IMap<K, V>
Returns an empty map with the same configuration.
inherited
contains(K key, V value) bool
Returns true if the map contains an element equal to the key-value pair, false otherwise.
inherited
containsEntry(MapEntry<K, V> entry) bool
Returns true if the map contains the entry, false otherwise.
inherited
containsKey(K? key) bool
Returns true if the map contains the key, false otherwise.
inherited
containsValue(V? value) bool
Returns true if the map contains the value, false otherwise.
inherited
entry(K key) MapEntry<K, V?>
Return the MapEntry for the given key. For key/value pairs that don't exist, it will return MapEntry(key, null);.
inherited
entryOrNull(K key) MapEntry<K, V>?
Return the MapEntry for the given key. For key/value pairs that don't exist, it will return null.
inherited
equalItems(covariant Iterable<MapEntry> other) bool
Will return true only if the IMap entries are equal to the entries in the Iterable. Order is irrelevant. This may be slow for very large maps, since it compares each entry, one by one. To compare with a map, use method equalItemsToMap or equalItemsToIMap.
inherited
equalItemsAndConfig(IMap other) bool
Will return true only if the list items are equal, and the map configurations are equal. This may be slow for very large maps, since it compares each item, one by one.
inherited
equalItemsToIMap(IMap other) bool
Will return true only if the two maps have the same number of entries, and if the entries of the two maps are pairwise equal on both key and value.
inherited
equalItemsToMap(Map other) bool
Will return true only if the two maps have the same number of entries, and if the entries of the two maps are pairwise equal on both key and value.
inherited
everyEntry(bool test(MapEntry<K, V>)) bool
Checks whether every entry of this iterable satisfies test.
inherited
forEach(void f(K key, V value)) → void
Applies the function f to each element.
inherited
get(K k) → V?
Returns the value for the given key or null if key is not in the map.
inherited
map<RK, RV>(MapEntry<RK, RV> mapper(K key, V value), {bool ifRemove(RK key, RV value)?, ConfigMap? config}) IMap<RK, RV>
Returns a new map where all entries of this map are transformed by the given mapper function. However, if ifRemove is provided, the mapped value will first be tested with it and, if ifRemove returns true, the value will be removed from the result map.
inherited
mapTo<T>(T mapper(K key, V value)) Iterable<T>
Returns a new lazy Iterable with elements that are created by calling mapper on each entry of this IMap in iteration order.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
putIfAbsent(K key, V ifAbsent(), {Output<V>? previousValue}) IMap<K, V>
Look up the value of key, or add a new value if it isn't there.
inherited
remove(K key) IMap<K, V>
Returns a new map containing the current map minus the given key and its value. However, if the current map doesn't contain the key, it will return the current map (same instance).
inherited
removeWhere(bool predicate(K key, V value)) IMap<K, V>
Returns a new map containing the current map minus the entries that satisfy the given predicate. However, if nothing is removed, it will return the current map (same instance).
inherited
same(IMap<K, V>? other) bool
Will return true only if the maps internals are the same instances (comparing by identity). This will be fast even for very large maps, since it doesn't compare each entry.
override
toEntryIList({int compare(MapEntry<K, V>? a, MapEntry<K, V>? b)?, ConfigList? config}) IList<MapEntry<K, V>>
Returns an IList of the map entries.
inherited
toEntryISet({ConfigSet? config}) ISet<MapEntry<K, V>>
Returns an ISet of the map entries. Optionally, you may provide a config for the set.
inherited
toEntryList({int compare(MapEntry<K, V> a, MapEntry<K, V> b)?}) List<MapEntry<K, V>>
Returns a List of the map entries.
inherited
toEntrySet({int compare(MapEntry<K, V> a, MapEntry<K, V> b)?}) Set<MapEntry<K, V>>
Returns a Set of the map entries. The set will be sorted if the map's sort configuration is true, or if you explicitly provide a compare method.
inherited
toJson(Object? toJsonK(K), Object? toJsonV(V)) Object
Converts to JSon. Json serialization support for json_serializable with @JsonSerializable.
inherited
toKeyIList({int compare(K? a, K? b)?, ConfigList? config}) IList<K>
Returns an IList of the map keys.
inherited
toKeyISet({ConfigSet? config}) ISet<K>
Returns an ISet of the map keys. Optionally, you may provide a config for the set.
inherited
toKeyList({int compare(K a, K b)?}) List<K>
Returns a List of the map keys.
inherited
toKeySet({int compare(K a, K b)?}) Set<K>
Returns a Set of the map keys. The set will be sorted if the map's sort configuration is true, or if you explicitly provide a compare method.
inherited
toString([bool? prettyPrint]) String
Returns a string representation of (some of) the elements of this.
inherited
toValueIList({bool sort = false, int compare(V a, V b)?, ConfigList? config}) IList<V>
Returns an IList of the map values.
inherited
toValueISet({ConfigSet? config}) ISet<V>
Returns an ISet of the map values. Optionally, you may provide a config for the set.
inherited
toValueList({bool sort = false, int compare(V a, V b)?}) List<V>
Returns a List of the map values.
inherited
toValueSet({int compare(V a, V b)?}) Set<V>
Returns a Set of the map values. The set will be sorted if the map's sortValues configuration is true, or if you explicitly provide a compare method.
inherited
update(K key, V update(V value), {bool ifRemove(K key, V value)?, V ifAbsent()?, Output<V>? previousValue}) IMap<K, V>
Updates the value for the provided key.
inherited
updateAll(V update(K key, V value), {bool ifRemove(K key, V value)?}) IMap<K, V>
Updates all values.
inherited
where(bool test(K key, V value)) IMap<K, V>
Returns an IMap with all elements that satisfy the predicate test.
inherited
withConfig(ConfigMap config) IMap<K, V>
Creates a new map with the given config.
inherited
withConfigFrom(IMap<K, V> other) IMap<K, V>
Returns a new map with the contents of the present IMap, but the config of other.
inherited

Operators

operator ==(Object other) bool
  • If isDeepEquals configuration is true: Will return true only if the map entries are equal (not necessarily in the same order), and the map configurations are equal. This may be slow for very large maps, since it compares each entry, one by one.

  • If isDeepEquals configuration is false: Will return true only if the maps internals are the same instances (comparing by identity). This will be fast even for very large maps, since it doesn't compare each entry.

  • inherited
    operator [](K k) → V?
    Returns the value for the given key or null if key is not in the map.
    inherited