TTMultiMapList<V> class

Return a TTMultiMap that stores values in a List

Returned TTMultiMap is a function:

  • f : KV ∪ V

such that

  • K is the set of all Keys
  • V is the set of all Values
  • ℕ is the set of Natural numbers
  • V is the set of all functions ℕ ↦ V
  • V contains the empty function ∅ ↦ V

By definition the Values sequence may feature the same Value multiple times. It is ordered by insertion.

The codomain of f includes the empty sequence. This allows Keys to be stored without Values, useful when you require only a set of Keys for searching purposes.

Implemented types

Constructors

TTMultiMapList({KeyMapping keyMapping = identity})
Construct a new TTMultiMapList with an optional keyMapping
TTMultiMapList.from(TTMultiMap<V> other)
Create a TTMultiMapList from a TTMultiMap.
TTMultiMapList.fromIterables(Iterable<String> keys, Iterable<V> values, {KeyMapping keyMapping = identity})
Create a TTMultiMapList from Iterables of keys and values.
TTMultiMapList.fromJson(Map<String, dynamic> json, {KeyMapping keyMapping = identity})
Construct a NodeList from the given Json
TTMultiMapList.fromMap(Map<String, Iterable<V>> map, {KeyMapping keyMapping = identity})
Create a TTMultiMapList from a Map.

Properties

entries Iterable<MapEntry<String, List<V>>>
Iterates through TTMultiMap as MapEntry objects.
no setter
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Returns true if there are no keys in the TTMultiMap.
no setterinherited
isNotEmpty bool
Returns true if there is at least one key in the TTMultiMap.
no setterinherited
keyMapping KeyMapping
The KeyMapping in use by this TTMultiMap. Is applied to all incoming keys.
no setterinherited
keys TTIterable<String>
Return Iterable view of keys
no setterinherited
length int
The number of keys in the TTMultiMap.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
values Iterable<V>
Return Iterable view of values
no setterinherited

Methods

add(String key, V value) bool
Insert a key and value association.
inherited
addAll(TTMultiMap<V> other) → void
Add all key/value pairs from other.
inherited
addEntries(Iterable<MapEntry<String, Iterable<V>>> entries) → void
Adds all associations contained in entries to this TTMultiMap.
inherited
addKey(String key) bool
Add key to collection.
inherited
addKeys(Iterable<String> keys) → void
Add each key in keys.
inherited
addValues(String key, Iterable<V> values) → void
Add all values to specified key
inherited
asMap() Map<String, List<V>>
Return a view of this TTMultiMap as a Map
clear() → void
Removes all data from the TTMultiMap.
inherited
contains(String key, V value) bool
Returns whether this TTMultiMap contains an association between keyMapping(key) and value.
inherited
containsKey(String key) bool
Returns whether this TTMultiMap contains key.
inherited
containsValue(V value) bool
Returns whether this TTMultiMap contains value at least once.
inherited
entriesByKeyPrefix(String prefix, {int maxPrefixEditDistance = 0}) TTIterable<MapEntry<String, List<V>>>
Iterates through TTMultiMap as MapEntry objects such that only keys prefixed by keyMapping(prefix) are included.
forEach(void f(String key, V value)) → void
Applies f to each key/value pair of the TTMultiMap
inherited
forEachKey(void f(String key, List<V> values)) → void
Applies f to each key/value pair of the TTMultiMap where key matches specified key.
forEachKeyPrefixedBy(String prefix, void f(String key, List<V> values), {int maxPrefixEditDistance = 0}) → void
Applies f to each key/value pair of the TTMultiMap where key is prefixed by prefix.
keysByPrefix(String prefix, {int maxPrefixEditDistance = 0}) TTIterable<String>
Iterates through TTMultiMap keys such that only keys prefixed by keyMapping(prefix) are included.
inherited
longestCommonKeyPrefixByKeyPrefix(String prefix) String
Find the longest common key prefix for all keys prefixed by prefix.
inherited
lookup(String key, V value) → V?
If TTMultiMap contains specified (key, value) pair then return stored value.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(String key, V value) bool
Removes the association between the given key and value.
inherited
removeKey(String key) List<V>?
Removes key and all associated values.
removeValues(String key) List<V>?
Removes all values associated with key. The key remains present, mapped to an empty iterable.
sizeOf([int valueSizeInBytes = 0]) int
Return approximate size of tree in bytes
inherited
toJson({bool includeValues = true, dynamic valueToEncodable(V value)?}) Map<String, dynamic>
Return Json representation of TTMultiMap.
inherited
toString({String paddingChar = '-'}) String
A string representation of this object.
inherited
valuesByKeyPrefix(String prefix, {int maxPrefixEditDistance = 0}) TTIterable<V>
Iterates through TTMultiMap values for each key such that only keys prefixed by keyMapping(prefix) are included.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String key) List<V>?
Return Iterable of values for specified key.
operator []=(String key, Iterable<V> values) → void
Set Iterable of values corresponding to key.
inherited