Table of Contents

Property Pairs

Namespace
SodaFlow.Collections
Assembly
SodaFlow.Core.Collections.dll

Pairs

Each key with its state, in no sequence. This is one read of the map and not one lookup for each key.

public abstract IEnumerable<KeyValuePair<TKey, TState>> Pairs { get; }

Property Value

IEnumerable<KeyValuePair<TKey, TState>>

Remarks

This is for code that reads the full collection, such as a total, an average, or a count of the items that agree with a predicate. An enumeration of Keys with a call of TryGetState(TKey, out TState?) for each key gives the same answer and costs one lookup for each item. On the default trie each lookup is O(log32 n) of pointer reads, and it reads the full structure in the sequence of the keys and not in the sequence of the storage. A measurement shows this: on one hundred thousand items, a total of one field with one lookup for each key cost more than a sort of the full collection.