LanguageExt.Core

LanguageExt.Core Immutable Collections TrackingHashMap

Contents

struct TrackingHashMap <K, V> Source #

Unsorted immutable hash-map that tracks changes.

Changes are accessible via the Changes property. It is a HashMap of Change values from either the initial empty state of the collection, or since the last call to Snapshot().

The fact that the changes are represented as a single-value HashMap shows that the tracked changes are not an ever increasing log of changes, but instead a morphism between one previous state of the TrackingHashMap and another. Therefore there's at most one morphism for each key, and potentially none.

The morphisms are:

* `EntryAdded`
* `EntryMapped`
* `EntryRemoved`

A new 'zero-changes starting-state' can be created by calling Snapshot(). Snapshot creates the first snapshot (effectively clears the Changes to zero), and Changes will collect the difference from this point to any morphed future-state as collection-transforming operations are performed

Parameters

type K

Key type

type V

Value

Indexers

this [ V ] Source #

'this' accessor

Parameters

param key

Key

returns

Optional value

Properties

property TrackingHashMap<K, V> Empty Source #

property HashMap<K, Change<V>> Changes Source #

property bool IsEmpty Source #

Is the map empty

property int Count Source #

Number of items in the map

property int Length Source #

Alias of Count

property Iterable<K> Keys Source #

Enumerable of map keys

property Iterable<V> Values Source #

Enumerable of map values

Constructors

constructor TrackingHashMap (IEnumerable<(K Key, V Value)> items) Source #

constructor TrackingHashMap (IEnumerable<(K Key, V Value)> items, bool tryAdd) Source #

constructor TrackingHashMap (ReadOnlySpan<(K Key, V Value)> items) Source #

constructor TrackingHashMap (ReadOnlySpan<(K Key, V Value)> items, bool tryAdd) Source #

Methods

method TrackingHashMap<K, V> Snapshot () Source #

Creates a 'zero change' snapshot. The data does not change!

Useful for creating new starting points for capturing the difference between two snapshots of the TrackingHashMap. Snapshot creates the first snapshot (effectively clears the Changes to zero), and Changes will collect the difference from this point to any morphed future point as collection transforming operations are performed

Parameters

returns

Map with changes zeroed

method Lens<TrackingHashMap<K, V>, V> item (K key) Source #

Item at index lens

method Lens<TrackingHashMap<K, V>, Option<V>> itemOrNone (K key) Source #

Item or none at index lens

method TrackingHashMap<K, V> Filter (Func<V, bool> pred) Source #

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method TrackingHashMap<K, V> Filter (Func<K, V, bool> pred) Source #

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method TrackingHashMap<K, V> Add (K key, V value) Source #

Atomically adds a new item to the map

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<K, V> TryAdd (K key, V value) Source #

Atomically adds a new item to the map. If the key already exists, then the new item is ignored

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<K, V> AddOrUpdate (K key, V value) Source #

Atomically adds a new item to the map. If the key already exists, the new item replaces it.

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<K, V> AddOrUpdate (K key, Func<V, V> Some, Func<V> None) Source #

Retrieve a value from the map by key, map it to a new value, put it back. If it doesn't exist, add a new one based on None result.

Parameters

param key

Key to find

returns

New map with the mapped value

method TrackingHashMap<K, V> AddOrUpdate (K key, Func<V, V> Some, V None) Source #

Retrieve a value from the map by key, map it to a new value, put it back. If it doesn't exist, add a new one based on None result.

Parameters

param key

Key to find

returns

New map with the mapped value

method TrackingHashMap<K, V> AddRange (IEnumerable<Tuple<K, V>> range) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> AddRange (IEnumerable<(K Key, V Value)> range) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> TryAddRange (IEnumerable<Tuple<K, V>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> TryAddRange (IEnumerable<(K Key, V Value)> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> TryAddRange (IEnumerable<KeyValuePair<K, V>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of KeyValuePairs to add

returns

New Map with the items added

method TrackingHashMap<K, V> AddOrUpdateRange (IEnumerable<Tuple<K, V>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> AddOrUpdateRange (IEnumerable<(K Key, V Value)> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> AddOrUpdateRange (IEnumerable<KeyValuePair<K, V>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of KeyValuePairs to add

returns

New Map with the items added

method TrackingHashMap<K, V> Remove (K key) Source #

Atomically removes an item from the map If the key doesn't exists, the request is ignored.

Parameters

param key

Key

returns

New map with the item removed

method Option<V> Find (K key) Source #

Retrieve a value from the map by key

Parameters

param key

Key to find

returns

Found value

method Seq<V> FindSeq (K key) Source #

Retrieve a value from the map by key as an enumerable

Parameters

param key

Key to find

returns

Found value

method R Find <R> (K key, Func<V, R> Some, Func<R> None) Source #

Retrieve a value from the map by key and pattern match the result.

Parameters

param key

Key to find

returns

Found value

method (TrackingHashMap<K, V> Map, V Value) FindOrAdd (K key, Func<V> None) Source #

Try to find the key in the map, if it doesn't exist, add a new item by invoking the delegate provided.

Parameters

param key

Key to find

param None

Delegate to get the value

returns

Updated map and added value

method (TrackingHashMap<K, V>, V Value) FindOrAdd (K key, V value) Source #

Try to find the key in the map, if it doesn't exist, add a new item provided.

Parameters

param key

Key to find

param value

Delegate to get the value

returns

Updated map and added value

method (TrackingHashMap<K, V> Map, Option<V> Value) FindOrMaybeAdd (K key, Func<Option<V>> None) Source #

Try to find the key in the map, if it doesn't exist, add a new item by invoking the delegate provided.

Parameters

param key

Key to find

param None

Delegate to get the value

returns

Updated map and added value

method (TrackingHashMap<K, V> Map, Option<V> Value) FindOrMaybeAdd (K key, Option<V> None) Source #

Try to find the key in the map, if it doesn't exist, add a new item by invoking the delegate provided.

Parameters

param key

Key to find

param None

Delegate to get the value

returns

Updated map and added value

method TrackingHashMap<K, V> SetItem (K key, V value) Source #

Atomically updates an existing item

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<K, V> SetItem (K key, Func<V, V> Some) Source #

Retrieve a value from the map by key, map it to a new value, put it back.

Parameters

param key

Key to set

returns

New map with the mapped value

method TrackingHashMap<K, V> TrySetItem (K key, V value) Source #

Atomically updates an existing item, unless it doesn't exist, in which case it is ignored

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<K, V> TrySetItem (K key, Func<V, V> Some) Source #

Atomically sets an item by first retrieving it, applying a map, and then putting it back. Silently fails if the value doesn't exist

Parameters

param key

Key to set

param Some

delegate to map the existing value to a new one before setting

returns

New map with the item set

method bool ContainsKey (K key) Source #

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool Contains (K key, V value) Source #

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool Contains (V value) Source #

Checks for existence of a value in the map

Parameters

param value

Value to check

returns

True if an item with the value supplied is in the map

method bool Contains <EqV> (V value) Source #

where EqV : Eq<V>

Checks for existence of a value in the map

Parameters

param value

Value to check

returns

True if an item with the value supplied is in the map

method bool Contains <EqV> (K key, V value) Source #

where EqV : Eq<V>

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method TrackingHashMap<K, V> Clear () Source #

Clears all items from the map

Functionally equivalent to calling Map.empty as the original structure is untouched

Parameters

returns

Empty map

method TrackingHashMap<K, V> AddRange (IEnumerable<KeyValuePair<K, V>> pairs) Source #

Atomically adds a range of items to the map

Parameters

param pairs

Range of KeyValuePairs to add

returns

New Map with the items added

method TrackingHashMap<K, V> SetItems (IEnumerable<KeyValuePair<K, V>> items) Source #

Atomically sets a series of items using the KeyValuePairs provided

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> SetItems (IEnumerable<Tuple<K, V>> items) Source #

Atomically sets a series of items using the Tuples provided.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> SetItems (IEnumerable<(K Key, V Value)> items) Source #

Atomically sets a series of items using the Tuples provided.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> TrySetItems (IEnumerable<KeyValuePair<K, V>> items) Source #

Atomically sets a series of items using the KeyValuePairs provided. If any of the items don't exist then they're silently ignored.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> TrySetItems (IEnumerable<Tuple<K, V>> items) Source #

Atomically sets a series of items using the Tuples provided If any of the items don't exist then they're silently ignored.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> TrySetItems (IEnumerable<(K Key, V Value)> items) Source #

Atomically sets a series of items using the Tuples provided If any of the items don't exist then they're silently ignored.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> TrySetItems (IEnumerable<K> keys, Func<V, V> Some) Source #

Atomically sets a series of items using the keys provided to find the items and the Some delegate maps to a new value. If the items don't exist then they're silently ignored.

Parameters

param keys

Keys of items to set

param Some

Function map the existing item to a new one

returns

New map with the items set

method TrackingHashMap<K, V> RemoveRange (IEnumerable<K> keys) Source #

Atomically removes a set of keys from the map

Parameters

param keys

Keys to remove

returns

New map with the items removed

method bool Contains (KeyValuePair<K, V> pair) Source #

Returns true if a Key/Value pair exists in the map

Parameters

param pair

Pair to find

returns

True if exists, false otherwise

method IReadOnlyDictionary<K, V> ToDictionary () Source #

Convert the map to an IDictionary

Parameters

returns

method IDictionary<KR, VR> ToDictionary <KR, VR> ( Func<(K Key, V Value), KR> keySelector, Func<(K Key, V Value), VR> valueSelector) Source #

where KR : notnull

Map the map the a dictionary

method IEnumerator<(K Key, V Value)> GetEnumerator () Source #

GetEnumerator - IEnumerable interface

method Seq<(K Key, V Value)> ToSeq () Source #

method HashMap<K, V> ToHashMap () Source #

Allocation free conversion to a HashMap

method string ToString () Source #

Format the collection as [(key: value), (key: value), (key: value), ...] The elipsis is used for collections over 50 items To get a formatted string with all the items, use ToFullString or ToFullArrayString.

method string ToFullString (string separator = ", ") Source #

Format the collection as (key: value), (key: value), (key: value), ...

method string ToFullArrayString (string separator = ", ") Source #

Format the collection as [(key: value), (key: value), (key: value), ...]

method Iterable<(K Key, V Value)> AsEnumerable () Source #

method TrackingHashMap<K, V> Combine (TrackingHashMap<K, V> rhs) Source #

method TrackingHashMap<K, V> Subtract (TrackingHashMap<K, V> rhs) Source #

method bool IsProperSubsetOf (IEnumerable<(K Key, V Value)> other) Source #

Returns True if 'other' is a proper subset of this set

Parameters

returns

True if 'other' is a proper subset of this set

method bool IsProperSubsetOf (IEnumerable<K> other) Source #

Returns True if 'other' is a proper subset of this set

Parameters

returns

True if 'other' is a proper subset of this set

method bool IsProperSupersetOf (IEnumerable<(K Key, V Value)> other) Source #

Returns True if 'other' is a proper superset of this set

Parameters

returns

True if 'other' is a proper superset of this set

method bool IsProperSupersetOf (IEnumerable<K> other) Source #

Returns True if 'other' is a proper superset of this set

Parameters

returns

True if 'other' is a proper superset of this set

method bool IsSubsetOf (IEnumerable<(K Key, V Value)> other) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method bool IsSubsetOf (IEnumerable<K> other) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method bool IsSubsetOf (TrackingHashMap<K, V> other) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method bool IsSupersetOf (IEnumerable<(K Key, V Value)> other) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method bool IsSupersetOf (IEnumerable<K> rhs) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method TrackingHashMap<K, V> Intersect (IEnumerable<K> rhs) Source #

Returns the elements that are in both this and other

method TrackingHashMap<K, V> Intersect (IEnumerable<(K Key, V Value)> rhs) Source #

Returns the elements that are in both this and other

method TrackingHashMap<K, V> Intersect (IEnumerable<(K Key, V Value)> rhs, WhenMatched<K, V, V, V> Merge) Source #

Returns the elements that are in both this and other

method TrackingHashMap<K, V> Intersect (HashMap<K, V> rhs, WhenMatched<K, V, V, V> Merge) Source #

Returns the elements that are in both this and other

method TrackingHashMap<K, V> Intersect (TrackingHashMap<K, V> rhs, WhenMatched<K, V, V, V> Merge) Source #

Returns the elements that are in both this and other

method bool Overlaps (IEnumerable<(K Key, V Value)> other) Source #

Returns True if other overlaps this set

method bool Overlaps (IEnumerable<K> other) Source #

Returns True if other overlaps this set

method TrackingHashMap<K, V> Except (IEnumerable<K> rhs) Source #

Returns this - other. Only the items in this that are not in other will be returned.

method TrackingHashMap<K, V> Except (IEnumerable<(K Key, V Value)> rhs) Source #

Returns this - other. Only the items in this that are not in other will be returned.

method TrackingHashMap<K, V> SymmetricExcept (TrackingHashMap<K, V> rhs) Source #

Only items that are in one set or the other will be returned. If an item is in both, it is dropped.

method TrackingHashMap<K, V> SymmetricExcept (IEnumerable<(K Key, V Value)> rhs) Source #

Only items that are in one set or the other will be returned. If an item is in both, it is dropped.

method TrackingHashMap<K, V> Union (IEnumerable<(K, V)> rhs) Source #

Finds the union of two sets and produces a new set with the results

Parameters

param other

Other set to union with

returns

A set which contains all items from both sets

method TrackingHashMap<K, V> Union (IEnumerable<(K Key, V Value)> other, WhenMatched<K, V, V, V> Merge) Source #

Union two maps.

The WhenMatched merge function is called when keys are present in both map to allow resolving to a sensible value.

method TrackingHashMap<K, V> Union <W> (IEnumerable<(K Key, W Value)> other, WhenMissing<K, W, V> MapRight, WhenMatched<K, V, W, V> Merge) Source #

Union two maps.

The WhenMatched merge function is called when keys are present in both map to allow resolving to a sensible value.

The WhenMissing function is called when there is a key in the right-hand side, but not the left-hand-side. This allows the V2 value-type to be mapped to the target V value-type.

method bool Equals (object? obj) Source #

Equality of keys and values with EqDefault<V> used for values

method bool Equals (TrackingHashMap<K, V> other) Source #

Equality of keys and values with EqDefault<V> used for values

method bool Equals <EqV> (TrackingHashMap<K, V> other) Source #

where EqV : Eq<V>

Equality of keys and values with EqV used for values

method bool EqualsKeys (TrackingHashMap<K, V> other) Source #

Equality of keys only

method int GetHashCode () Source #

method TrackingHashMap<K, V> Do (Action<V> f) Source #

Impure iteration of the bound values in the structure

Parameters

returns

Returns the original unmodified structure

method TrackingHashMap<K, V> Where (Func<V, bool> pred) Source #

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method TrackingHashMap<K, V> Where (Func<K, V, bool> pred) Source #

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method bool ForAll (Func<K, V, bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool ForAll (Func<(K Key, V Value), bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool ForAll (Func<KeyValuePair<K, V>, bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool ForAll (Func<V, bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool Exists (Func<K, V, bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool Exists (Func<(K Key, V Value), bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool Exists (Func<KeyValuePair<K, V>, bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool Exists (Func<V, bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method Unit Iter (Action<K, V> action) Source #

Atomically iterate through all key/value pairs in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method Unit Iter (Action<V> action) Source #

Atomically iterate through all values in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method Unit Iter (Action<Tuple<K, V>> action) Source #

Atomically iterate through all key/value pairs (as tuples) in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method Unit Iter (Action<(K Key, V Value)> action) Source #

Atomically iterate through all key/value pairs (as tuples) in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method Unit Iter (Action<KeyValuePair<K, V>> action) Source #

Atomically iterate through all key/value pairs in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method S Fold <S> (S state, Func<S, K, V, S> folder) Source #

Atomically folds all items in the map (in order) using the folder function provided.

Parameters

type S

State type

param state

Initial state

param folder

Fold function

returns

Folded state

method S Fold <S> (S state, Func<S, V, S> folder) Source #

Atomically folds all items in the map (in order) using the folder function provided.

Parameters

type S

State type

param state

Initial state

param folder

Fold function

returns

Folded state

method bool TryGetValue (K key, out V value) Source #

method IReadOnlyDictionary<K, V> ToReadOnlyDictionary () Source #

Get a IReadOnlyDictionary for this map. No mapping is required, so this is very fast.

Operators

operator == (TrackingHashMap<K, V> lhs, TrackingHashMap<K, V> rhs) Source #

Equality of keys and values with EqDefault<V> used for values

operator != (TrackingHashMap<K, V> lhs, TrackingHashMap<K, V> rhs) Source #

In-equality of keys and values with EqDefault<V> used for values

operator + (TrackingHashMap<K, V> lhs, TrackingHashMap<K, V> rhs) Source #

operator - (TrackingHashMap<K, V> lhs, TrackingHashMap<K, V> rhs) Source #

struct TrackingHashMap <EqK, K, V> Source #

where EqK : Eq<K>

Unsorted immutable hash-map that tracks changes.

Changes are accessible via the Changes property. It is a HashMap of Change values from either the initial empty state of the collection, or since the last call to Snapshot().

The fact that the changes are represented as a single-value HashMap shows that the tracked changes are not an ever increasing log of changes, but instead a morphism between one previous state of the TrackingHashMap and another. Therefore there's at most one morphism for each key, and potentially none.

The morphisms are:

* `EntryAdded`
* `EntryMapped`
* `EntryRemoved`

A new 'zero-changes starting-state' can be created by calling Snapshot(). Snapshot creates the first snapshot (effectively clears the Changes to zero), and Changes will collect the difference from this point to any morphed future-state as collection-transforming operations are performed

Parameters

type K

Key type

type V

Value

Indexers

this [ V ] Source #

'this' accessor

Parameters

param key

Key

returns

Optional value

Properties

property TrackingHashMap<EqK, K, V> Empty Source #

property HashMap<EqK, K, Change<V>> Changes Source #

property bool IsEmpty Source #

Is the map empty

property int Count Source #

Number of items in the map

property int Length Source #

Alias of Count

property Iterable<K> Keys Source #

Enumerable of map keys

property Iterable<V> Values Source #

Enumerable of map values

Constructors

constructor TrackingHashMap (IEnumerable<(K Key, V Value)> items) Source #

constructor TrackingHashMap (IEnumerable<(K Key, V Value)> items, bool tryAdd) Source #

constructor TrackingHashMap (ReadOnlySpan<(K Key, V Value)> items) Source #

constructor TrackingHashMap (ReadOnlySpan<(K Key, V Value)> items, bool tryAdd) Source #

Methods

method TrackingHashMap<EqK, K, V> Snapshot () Source #

Creates a 'zero change' snapshot. The data does not change!

Useful for creating new starting points for capturing the difference between two snapshots of the TrackingHashMap. Snapshot creates the first snapshot (effectively clears the Changes to zero), and Changes will collect the difference from this point to any morphed future point as collection- transforming operations are performed

Parameters

returns

Map with changes zeroed

method Lens<TrackingHashMap<EqK, K, V>, V> item (K key) Source #

Item at index lens

method Lens<TrackingHashMap<EqK, K, V>, Option<V>> itemOrNone (K key) Source #

Item or none at index lens

method TrackingHashMap<EqK, K, V> Filter (Func<V, bool> pred) Source #

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method TrackingHashMap<EqK, K, V> Filter (Func<K, V, bool> pred) Source #

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method TrackingHashMap<EqK, K, V> Add (K key, V value) Source #

Atomically adds a new item to the map

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<EqK, K, V> TryAdd (K key, V value) Source #

Atomically adds a new item to the map. If the key already exists, then the new item is ignored

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<EqK, K, V> AddOrUpdate (K key, V value) Source #

Atomically adds a new item to the map. If the key already exists, the new item replaces it.

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<EqK, K, V> AddOrUpdate (K key, Func<V, V> Some, Func<V> None) Source #

Retrieve a value from the map by key, map it to a new value, put it back. If it doesn't exist, add a new one based on None result.

Parameters

param key

Key to find

returns

New map with the mapped value

method TrackingHashMap<EqK, K, V> AddOrUpdate (K key, Func<V, V> Some, V None) Source #

Retrieve a value from the map by key, map it to a new value, put it back. If it doesn't exist, add a new one based on None result.

Parameters

param key

Key to find

returns

New map with the mapped value

method TrackingHashMap<EqK, K, V> AddRange (IEnumerable<Tuple<K, V>> range) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> AddRange (IEnumerable<(K Key, V Value)> range) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> TryAddRange (IEnumerable<Tuple<K, V>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> TryAddRange (IEnumerable<(K Key, V Value)> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> TryAddRange (IEnumerable<KeyValuePair<K, V>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of KeyValuePairs to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> AddOrUpdateRange (IEnumerable<Tuple<K, V>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> AddOrUpdateRange (IEnumerable<(K Key, V Value)> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> AddOrUpdateRange (IEnumerable<KeyValuePair<K, V>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of KeyValuePairs to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> Remove (K key) Source #

Atomically removes an item from the map If the key doesn't exists, the request is ignored.

Parameters

param key

Key

returns

New map with the item removed

method Option<V> Find (K key) Source #

Retrieve a value from the map by key

Parameters

param key

Key to find

returns

Found value

method Seq<V> FindSeq (K key) Source #

Retrieve a value from the map by key as an enumerable

Parameters

param key

Key to find

returns

Found value

method R Find <R> (K key, Func<V, R> Some, Func<R> None) Source #

Retrieve a value from the map by key and pattern match the result.

Parameters

param key

Key to find

returns

Found value

method (TrackingHashMap<EqK, K, V> Map, V Value) FindOrAdd (K key, Func<V> None) Source #

Try to find the key in the map, if it doesn't exist, add a new item by invoking the delegate provided.

Parameters

param key

Key to find

param None

Delegate to get the value

returns

Updated map and added value

method (TrackingHashMap<EqK, K, V>, V Value) FindOrAdd (K key, V value) Source #

Try to find the key in the map, if it doesn't exist, add a new item provided.

Parameters

param key

Key to find

param value

Delegate to get the value

returns

Updated map and added value

method (TrackingHashMap<EqK, K, V> Map, Option<V> Value) FindOrMaybeAdd (K key, Func<Option<V>> None) Source #

Try to find the key in the map, if it doesn't exist, add a new item by invoking the delegate provided.

Parameters

param key

Key to find

param None

Delegate to get the value

returns

Updated map and added value

method (TrackingHashMap<EqK, K, V> Map, Option<V> Value) FindOrMaybeAdd (K key, Option<V> None) Source #

Try to find the key in the map, if it doesn't exist, add a new item by invoking the delegate provided.

Parameters

param key

Key to find

param None

Delegate to get the value

returns

Updated map and added value

method TrackingHashMap<EqK, K, V> SetItem (K key, V value) Source #

Atomically updates an existing item

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<EqK, K, V> SetItem (K key, Func<V, V> Some) Source #

Retrieve a value from the map by key, map it to a new value, put it back.

Parameters

param key

Key to set

returns

New map with the mapped value

method TrackingHashMap<EqK, K, V> TrySetItem (K key, V value) Source #

Atomically updates an existing item, unless it doesn't exist, in which case it is ignored

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<EqK, K, V> TrySetItem (K key, Func<V, V> Some) Source #

Atomically sets an item by first retrieving it, applying a map, and then putting it back. Silently fails if the value doesn't exist

Parameters

param key

Key to set

param Some

delegate to map the existing value to a new one before setting

returns

New map with the item set

method bool ContainsKey (K key) Source #

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool Contains (K key, V value) Source #

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool Contains (V value) Source #

Checks for existence of a value in the map

Parameters

param value

Value to check

returns

True if an item with the value supplied is in the map

method bool Contains <EqV> (V value) Source #

where EqV : Eq<V>

Checks for existence of a value in the map

Parameters

param value

Value to check

returns

True if an item with the value supplied is in the map

method bool Contains <EqV> (K key, V value) Source #

where EqV : Eq<V>

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method TrackingHashMap<EqK, K, V> Clear () Source #

Clears all items from the map

Functionally equivalent to calling Map.empty as the original structure is untouched

Parameters

returns

Empty map

method TrackingHashMap<EqK, K, V> AddRange (IEnumerable<KeyValuePair<K, V>> pairs) Source #

Atomically adds a range of items to the map

Parameters

param pairs

Range of KeyValuePairs to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> SetItems (IEnumerable<KeyValuePair<K, V>> items) Source #

Atomically sets a series of items using the KeyValuePairs provided

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> SetItems (IEnumerable<Tuple<K, V>> items) Source #

Atomically sets a series of items using the Tuples provided.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> SetItems (IEnumerable<(K Key, V Value)> items) Source #

Atomically sets a series of items using the Tuples provided.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> TrySetItems (IEnumerable<KeyValuePair<K, V>> items) Source #

Atomically sets a series of items using the KeyValuePairs provided. If any of the items don't exist then they're silently ignored.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> TrySetItems (IEnumerable<Tuple<K, V>> items) Source #

Atomically sets a series of items using the Tuples provided If any of the items don't exist then they're silently ignored.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> TrySetItems (IEnumerable<(K Key, V Value)> items) Source #

Atomically sets a series of items using the Tuples provided If any of the items don't exist then they're silently ignored.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> TrySetItems (IEnumerable<K> keys, Func<V, V> Some) Source #

Atomically sets a series of items using the keys provided to find the items and the Some delegate maps to a new value. If the items don't exist then they're silently ignored.

Parameters

param keys

Keys of items to set

param Some

Function map the existing item to a new one

returns

New map with the items set

method TrackingHashMap<EqK, K, V> RemoveRange (IEnumerable<K> keys) Source #

Atomically removes a set of keys from the map

Parameters

param keys

Keys to remove

returns

New map with the items removed

method bool Contains (KeyValuePair<K, V> pair) Source #

Returns true if a Key/Value pair exists in the map

Parameters

param pair

Pair to find

returns

True if exists, false otherwise

method IReadOnlyDictionary<K, V> ToDictionary () Source #

Convert the map to an IDictionary

Parameters

returns

method IDictionary<KR, VR> ToDictionary <KR, VR> ( Func<(K Key, V Value), KR> keySelector, Func<(K Key, V Value), VR> valueSelector) Source #

where KR : notnull

Map the map the a dictionary

method IEnumerator<(K Key, V Value)> GetEnumerator () Source #

GetEnumerator - IEnumerable interface

method Seq<(K Key, V Value)> ToSeq () Source #

method HashMap<EqK, K, V> ToHashMap () Source #

Allocation free conversion to a HashMap

method string ToString () Source #

Format the collection as [(key: value), (key: value), (key: value), ...] The elipsis is used for collections over 50 items To get a formatted string with all the items, use ToFullString or ToFullArrayString.

method string ToFullString (string separator = ", ") Source #

Format the collection as (key: value), (key: value), (key: value), ...

method string ToFullArrayString (string separator = ", ") Source #

Format the collection as [(key: value), (key: value), (key: value), ...]

method Iterable<(K Key, V Value)> AsEnumerable () Source #

method TrackingHashMap<EqK, K, V> Combine (TrackingHashMap<EqK, K, V> rhs) Source #

method TrackingHashMap<EqK, K, V> Subtract (TrackingHashMap<EqK, K, V> rhs) Source #

method bool IsProperSubsetOf (IEnumerable<(K Key, V Value)> other) Source #

Returns True if 'other' is a proper subset of this set

Parameters

returns

True if 'other' is a proper subset of this set

method bool IsProperSubsetOf (IEnumerable<K> other) Source #

Returns True if 'other' is a proper subset of this set

Parameters

returns

True if 'other' is a proper subset of this set

method bool IsProperSupersetOf (IEnumerable<(K Key, V Value)> other) Source #

Returns True if 'other' is a proper superset of this set

Parameters

returns

True if 'other' is a proper superset of this set

method bool IsProperSupersetOf (IEnumerable<K> other) Source #

Returns True if 'other' is a proper superset of this set

Parameters

returns

True if 'other' is a proper superset of this set

method bool IsSubsetOf (IEnumerable<(K Key, V Value)> other) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method bool IsSubsetOf (IEnumerable<K> other) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method bool IsSubsetOf (TrackingHashMap<EqK, K, V> other) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method bool IsSupersetOf (IEnumerable<(K Key, V Value)> other) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method bool IsSupersetOf (IEnumerable<K> rhs) Source #

Returns True if 'other' is a superset of this set

Parameters

returns

True if 'other' is a superset of this set

method TrackingHashMap<EqK, K, V> Intersect (IEnumerable<K> rhs) Source #

Returns the elements that are in both this and other

method TrackingHashMap<EqK, K, V> Intersect (IEnumerable<(K Key, V Value)> rhs) Source #

Returns the elements that are in both this and other

method TrackingHashMap<EqK, K, V> Intersect (IEnumerable<(K Key, V Value)> rhs, WhenMatched<K, V, V, V> Merge) Source #

Returns the elements that are in both this and other

method TrackingHashMap<EqK, K, V> Intersect (HashMap<EqK, K, V> rhs, WhenMatched<K, V, V, V> Merge) Source #

Returns the elements that are in both this and other

method TrackingHashMap<EqK, K, V> Intersect (TrackingHashMap<EqK, K, V> rhs, WhenMatched<K, V, V, V> Merge) Source #

Returns the elements that are in both this and other

method bool Overlaps (IEnumerable<(K Key, V Value)> other) Source #

Returns True if other overlaps this set

method bool Overlaps (IEnumerable<K> other) Source #

Returns True if other overlaps this set

method TrackingHashMap<EqK, K, V> Except (IEnumerable<K> rhs) Source #

Returns this - other. Only the items in this that are not in other will be returned.

method TrackingHashMap<EqK, K, V> Except (IEnumerable<(K Key, V Value)> rhs) Source #

Returns this - other. Only the items in this that are not in other will be returned.

method TrackingHashMap<EqK, K, V> SymmetricExcept (TrackingHashMap<EqK, K, V> rhs) Source #

Only items that are in one set or the other will be returned. If an item is in both, it is dropped.

method TrackingHashMap<EqK, K, V> SymmetricExcept (IEnumerable<(K Key, V Value)> rhs) Source #

Only items that are in one set or the other will be returned. If an item is in both, it is dropped.

method TrackingHashMap<EqK, K, V> Union (IEnumerable<(K, V)> rhs) Source #

Finds the union of two sets and produces a new set with the results

Parameters

param other

Other set to union with

returns

A set which contains all items from both sets

method TrackingHashMap<EqK, K, V> Union (IEnumerable<(K Key, V Value)> other, WhenMatched<K, V, V, V> Merge) Source #

Union two maps.

The WhenMatched merge function is called when keys are present in both map to allow resolving to a sensible value.

method TrackingHashMap<EqK, K, V> Union <W> (IEnumerable<(K Key, W Value)> other, WhenMissing<K, W, V> MapRight, WhenMatched<K, V, W, V> Merge) Source #

Union two maps.

The WhenMatched merge function is called when keys are present in both map to allow resolving to a sensible value.

The WhenMissing function is called when there is a key in the right-hand side, but not the left-hand-side. This allows the V2 value-type to be mapped to the target V value-type.

method bool Equals (object? obj) Source #

Equality of keys and values with EqDefault<V> used for values

method bool Equals (TrackingHashMap<EqK, K, V> other) Source #

Equality of keys and values with EqDefault<V> used for values

method bool Equals <EqV> (TrackingHashMap<EqK, K, V> other) Source #

where EqV : Eq<V>

Equality of keys and values with EqV used for values

method bool EqualsKeys (TrackingHashMap<EqK, K, V> other) Source #

Equality of keys only

method int GetHashCode () Source #

method TrackingHashMap<EqK, K, V> Do (Action<V> f) Source #

Impure iteration of the bound values in the structure

Parameters

returns

Returns the original unmodified structure

method TrackingHashMap<EqK, K, V> Where (Func<V, bool> pred) Source #

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method TrackingHashMap<EqK, K, V> Where (Func<K, V, bool> pred) Source #

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method bool ForAll (Func<K, V, bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool ForAll (Func<(K Key, V Value), bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool ForAll (Func<KeyValuePair<K, V>, bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool ForAll (Func<V, bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool Exists (Func<K, V, bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool Exists (Func<(K Key, V Value), bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool Exists (Func<KeyValuePair<K, V>, bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool Exists (Func<V, bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method Unit Iter (Action<K, V> action) Source #

Atomically iterate through all key/value pairs in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method Unit Iter (Action<V> action) Source #

Atomically iterate through all values in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method Unit Iter (Action<Tuple<K, V>> action) Source #

Atomically iterate through all key/value pairs (as tuples) in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method Unit Iter (Action<(K Key, V Value)> action) Source #

Atomically iterate through all key/value pairs (as tuples) in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method Unit Iter (Action<KeyValuePair<K, V>> action) Source #

Atomically iterate through all key/value pairs in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method S Fold <S> (S state, Func<S, K, V, S> folder) Source #

Atomically folds all items in the map (in order) using the folder function provided.

Parameters

type S

State type

param state

Initial state

param folder

Fold function

returns

Folded state

method bool TryGetValue (K key, out V value) Source #

method IReadOnlyDictionary<K, V> ToReadOnlyDictionary () Source #

Get a IReadOnlyDictionary for this map. No mapping is required, so this is very fast.

method S Fold <S> (S state, Func<S, V, S> folder) Source #

Atomically folds all items in the map (in order) using the folder function provided.

Parameters

type S

State type

param state

Initial state

param folder

Fold function

returns

Folded state

Operators

operator == (TrackingHashMap<EqK, K, V> lhs, TrackingHashMap<EqK, K, V> rhs) Source #

Equality of keys and values with EqDefault<V> used for values

operator != (TrackingHashMap<EqK, K, V> lhs, TrackingHashMap<EqK, K, V> rhs) Source #

In-equality of keys and values with EqDefault<V> used for values

operator + (TrackingHashMap<EqK, K, V> lhs, TrackingHashMap<EqK, K, V> rhs) Source #

operator - (TrackingHashMap<EqK, K, V> lhs, TrackingHashMap<EqK, K, V> rhs) Source #

class TrackingHashMapExtensions Source #

Methods

method TrackingHashMap<K, V> ToTrackingHashMap <K, V> (this IEnumerable<(K, V)> items) Source #

Create an immutable tracking hash-map

method TrackingHashMap<K, V> ToTrackingHashMap <K, V> (this IEnumerable<Tuple<K, V>> items) Source #

Create an immutable tracking hash-map

method TrackingHashMap<K, V> ToTrackingHashMap <K, V> (this IEnumerable<KeyValuePair<K, V>> items) Source #

Create an immutable tracking hash-map

method TrackingHashMap<K1, TrackingHashMap<K2, V>> ToTrackingHashMap <K1, K2, V> (this IEnumerable<(K1, K2, V)> items) Source #

Create an immutable tracking hash-map

method TrackingHashMap<K1, TrackingHashMap<K2, V>> ToTrackingHashMap <K1, K2, V> (this IEnumerable<Tuple<K1, K2, V>> items) Source #

Create an immutable tracking hash-map

method TrackingHashMap<K1, TrackingHashMap<K2, TrackingHashMap<K3, V>>> ToTrackingHashMap <K1, K2, K3, V> (this IEnumerable<(K1, K2, K3, V)> items) Source #

Create an immutable tracking hash-map

method TrackingHashMap<K1, TrackingHashMap<K2, TrackingHashMap<K3, V>>> ToTrackingHashMap <K1, K2, K3, V> (this IEnumerable<Tuple<K1, K2, K3, V>> items) Source #

Create an immutable tracking hash-map

method TrackingHashMap<K1, TrackingHashMap<K2, TrackingHashMap<K3, TrackingHashMap<K4, V>>>> ToTrackingHashMap <K1, K2, K3, K4, V> (this IEnumerable<(K1, K2, K3, K4, V)> items) Source #

Create an immutable tracking hash-map

method TrackingHashMap<K1, TrackingHashMap<K2, TrackingHashMap<K3, TrackingHashMap<K4, V>>>> ToTrackingHashMap <K1, K2, K3, K4, V> (this IEnumerable<Tuple<K1, K2, K3, K4, V>> items) Source #

Create an immutable tracking hash-map

method int Count <K, V> (this TrackingHashMap<K, V> self) Source #

Number of items in the map

method int Sum <K> (this TrackingHashMap<K, int> self) Source #

method Option<T> Find <A, B, T> (this TrackingHashMap<A, TrackingHashMap<B, T>> self, A outerKey, B innerKey) Source #

method Option<T> Find <A, B, C, T> (this TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, T>>> self, A aKey, B bKey, C cKey) Source #

method R Find <A, B, T, R> (this TrackingHashMap<A, TrackingHashMap<B, T>> self, A outerKey, B innerKey, Func<T, R> Some, Func<R> None) Source #

method R Find <A, B, C, T, R> (this TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, T>>> self, A aKey, B bKey, C cKey, Func<T, R> Some, Func<R> None) Source #

method R Find <A, B, C, D, T, R> (this TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, TrackingHashMap<D, T>>>> self, A aKey, B bKey, C cKey, D dKey, Func<T, R> Some, Func<R> None) Source #

method TrackingHashMap<A, TrackingHashMap<B, T>> AddOrUpdate <A, B, T> (this TrackingHashMap<A, TrackingHashMap<B, T>> self, A outerKey, B innerKey, Func<T, T> Some, Func<T> None) Source #

method TrackingHashMap<A, TrackingHashMap<B, T>> AddOrUpdate <A, B, T> (this TrackingHashMap<A, TrackingHashMap<B, T>> self, A outerKey, B innerKey, T value) Source #

method TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, T>>> AddOrUpdate <A, B, C, T> (this TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, T>>> self, A aKey, B bKey, C cKey, T value) Source #

method TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, T>>> AddOrUpdate <A, B, C, T> (this TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, T>>> self, A aKey, B bKey, C cKey, Func<T, T> Some, Func<T> None) Source #

method TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, TrackingHashMap<D, T>>>> AddOrUpdate <A, B, C, D, T> (this TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, TrackingHashMap<D, T>>>> self, A aKey, B bKey, C cKey, D dKey, T value) Source #

method TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, TrackingHashMap<D, T>>>> AddOrUpdate <A, B, C, D, T> (this TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, TrackingHashMap<D, T>>>> self, A aKey, B bKey, C cKey, D dKey, Func<T, T> Some, Func<T> None) Source #

method TrackingHashMap<A, TrackingHashMap<B, T>> Remove <A, B, T> (this TrackingHashMap<A, TrackingHashMap<B, T>> self, A outerKey, B innerKey) Source #

method TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, T>>> Remove <A, B, C, T> (this TrackingHashMap<A, TrackingHashMap<B, TrackingHashMap<C, T>>> self, A aKey, B bKey, C cKey) Source #

class TrackingHashMapExtensions Source #

Methods

method TrackingHashMap<EqK, K, V> ToTrackingHashMap <EqK, K, V> (this IEnumerable<(K, V)> items) Source #

where EqK : Eq<K>

Create an immutable tracking hash-map

method TrackingHashMap<EqK, K, V> ToTrackingHashMap <EqK, K, V> (this IEnumerable<Tuple<K, V>> items) Source #

where EqK : Eq<K>

Create an immutable tracking hash-map

method TrackingHashMap<EqK, K, V> ToTrackingHashMap <EqK, K, V> (this IEnumerable<KeyValuePair<K, V>> items) Source #

where EqK : Eq<K>

Create an immutable tracking hash-map

class TrackingHashMap Source #

Immutable tracking hash-map module

Methods

method TrackingHashMap<K, V> empty <K, V> () Source #

Creates a new empty TrackingHashMap

method TrackingHashMap<K, V> singleton <K, V> ((K, V) value) Source #

Creates a singleton TrackingHashMap

method TrackingHashMap<K, V> singleton <K, V> (K key, V value) Source #

Creates a singleton TrackingHashMap

method TrackingHashMap<K, V> create <K, V> () Source #

Creates a new empty TrackingHashMap

method TrackingHashMap<K, V> create <K, V> (Tuple<K, V> head, params Tuple<K, V>[] tail) Source #

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<K, V> create <K, V> ((K, V) head, params (K, V)[] tail) Source #

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<K, V> create <K, V> (KeyValuePair<K, V> head, params KeyValuePair<K,V>[] tail) Source #

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<K, V> createRange <K, V> (IEnumerable<Tuple<K, V>> keyValues) Source #

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<K, V> createRange <K, V> (IEnumerable<(K, V)> keyValues) Source #

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<K, V> createRange <K, V> (ReadOnlySpan<(K, V)> keyValues) Source #

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<K, V> createRange <K, V> (IEnumerable<KeyValuePair<K, V>> keyValues) Source #

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<K, V> add <K, V> (TrackingHashMap<K, V> map, K key, V value) Source #

Atomically adds a new item to the map

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<K, V> tryAdd <K, V> (TrackingHashMap<K, V> map, K key, V value) Source #

Atomically adds a new item to the map. If the key already exists, then the new item is ignored

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<K, V> addOrUpdate <K, V> (TrackingHashMap<K, V> map, K key, V value) Source #

Atomically adds a new item to the map. If the key already exists, the new item replaces it.

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<K, V> addOrUpdate <K, V> (TrackingHashMap<K, V> map, K key, Func<V, V> Some, Func<V> None) Source #

Retrieve a value from the map by key, map it to a new value, put it back. If it doesn't exist, add a new one based on None result.

Parameters

param key

Key to find

returns

New map with the mapped value

method TrackingHashMap<K, V> addOrUpdate <K, V> (TrackingHashMap<K, V> map, K key, Func<V, V> Some, V None) Source #

Retrieve a value from the map by key, map it to a new value, put it back. If it doesn't exist, add a new one based on None result.

Parameters

param key

Key to find

returns

New map with the mapped value

method TrackingHashMap<K, V> addRange <K, V> (TrackingHashMap<K, V> map, IEnumerable<Tuple<K, V>> keyValues) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> addRange <K, V> (TrackingHashMap<K, V> map, IEnumerable<(K, V)> keyValues) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> addRange <K, V> (TrackingHashMap<K, V> map, IEnumerable<KeyValuePair<K, V>> keyValues) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> tryAddRange <K, V> (TrackingHashMap<K, V> map, IEnumerable<Tuple<K, V>> keyValues) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> tryAddRange <K, V> (TrackingHashMap<K, V> map, IEnumerable<(K, V)> keyValues) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> tryAddRange <K, V> (TrackingHashMap<K, V> map, IEnumerable<KeyValuePair<K, V>> keyValues) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of KeyValuePairs to add

returns

New Map with the items added

method TrackingHashMap<K, V> addOrUpdateRange <K, V> (TrackingHashMap<K, V> map, IEnumerable<Tuple<K, V>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> addOrUpdateRange <K, V> (TrackingHashMap<K, V> map, IEnumerable<(K, V)> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<K, V> addOrUpdateRange <K, V> (TrackingHashMap<K, V> map, IEnumerable<KeyValuePair<K, V>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of KeyValuePairs to add

returns

New Map with the items added

method TrackingHashMap<K, V> remove <K, V> (TrackingHashMap<K, V> map, K key) Source #

Atomically removes an item from the map If the key doesn't exists, the request is ignored.

Parameters

param key

Key

returns

New map with the item removed

method bool containsKey <K, V> (TrackingHashMap<K, V> map, K key) Source #

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool contains <K, V> (TrackingHashMap<K, V> map, KeyValuePair<K, V> kv) Source #

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool contains <K, V> (TrackingHashMap<K, V> map, Tuple<K, V> kv) Source #

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool contains <K, V> (TrackingHashMap<K, V> map, (K, V) kv) Source #

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method TrackingHashMap<K, V> setItem <K, V> (TrackingHashMap<K, V> map, K key, V value) Source #

Atomically updates an existing item

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<K, V> trySetItem <K, V> (TrackingHashMap<K, V> map, K key, V value) Source #

Atomically updates an existing item, unless it doesn't exist, in which case it is ignored

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<K, V> trySetItem <K, V> (TrackingHashMap<K, V> map, K key, Func<V, V> Some) Source #

Atomically sets an item by first retrieving it, applying a map (Some), and then putting it back. Silently fails if the value doesn't exist.

Parameters

param key

Key to set

param Some

delegate to map the existing value to a new one before setting

returns

New map with the item set

method TrackingHashMap<K, V> setItems <K, V> (TrackingHashMap<K, V> map, IEnumerable<Tuple<K, V>> items) Source #

Atomically sets a series of items using the Tuples provided

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> setItems <K, V> (TrackingHashMap<K, V> map, IEnumerable<(K, V)> items) Source #

Atomically sets a series of items using the Tuples provided

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> setItems <K, V> (TrackingHashMap<K, V> map, IEnumerable<KeyValuePair<K, V>> items) Source #

Atomically sets a series of items using the KeyValuePairs provided

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> trySetItems <K, V> (TrackingHashMap<K, V> map, IEnumerable<Tuple<K, V>> items) Source #

Atomically sets a series of items using the Tuples provided.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> trySetItems <K, V> (TrackingHashMap<K, V> map, IEnumerable<(K, V)> items) Source #

Atomically sets a series of items using the Tuples provided.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> trySetItems <K, V> (TrackingHashMap<K, V> map, IEnumerable<KeyValuePair<K, V>> items) Source #

Atomically sets a series of items using the KeyValuePairs provided. If any of the items don't exist then they're silently ignored.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<K, V> trySetItems <K, V> (TrackingHashMap<K, V> map, IEnumerable<K> keys, Func<V, V> Some) Source #

Atomically sets a series of items using the keys provided to find the items and the Some delegate maps to a new value. If the items don't exist then they're silently ignored.

Parameters

param keys

Keys of items to set

param Some

Function map the existing item to a new one

returns

New map with the items set

method Option<V> find <K, V> (TrackingHashMap<K, V> map, K key) Source #

Retrieve a value from the map by key

Parameters

param key

Key to find

returns

Found value

method IEnumerable<V> findSeq <K, V> (TrackingHashMap<K, V> map, K key) Source #

Retrieve a value from the map by key as an enumerable

Parameters

param key

Key to find

returns

Found value

method R find <K, V, R> (TrackingHashMap<K, V> map, K key, Func<V, R> Some, Func<R> None) Source #

Retrieve a value from the map by key and pattern match the result.

Parameters

param key

Key to find

returns

Found value

method TrackingHashMap<K, V> setItem <K, V> (TrackingHashMap<K, V> map, K key, Func<V, V> mapper) Source #

Retrieve a value from the map by key, map it to a new value, put it back.

Parameters

param key

Key to find

returns

New map with the mapped value

method Unit iter <K, V> (TrackingHashMap<K, V> map, Action<V> action) Source #

Atomically iterate through all key/value pairs in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method Unit iter <K, V> (TrackingHashMap<K, V> map, Action<K, V> action) Source #

Atomically iterate through all key/value pairs in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method bool forall <K, V> (TrackingHashMap<K, V> map, Func<V, bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool forall <K, V> (TrackingHashMap<K, V> map, Func<K, V, bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool forall <K, V> (TrackingHashMap<K, V> map, Func<(K Key, V Value), bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool forall <K, V> (TrackingHashMap<K, V> map, Func<KeyValuePair<K, V>, bool> pred) Source #

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method TrackingHashMap<K, V> filter <K, V> (TrackingHashMap<K, V> map, Func<V, bool> predicate) Source #

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method TrackingHashMap<K, V> filter <K, V> (TrackingHashMap<K, V> map, Func<K, V, bool> predicate) Source #

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method int length <K, T> (TrackingHashMap<K, T> map) Source #

Number of items in the map

method S fold <S, K, V> (TrackingHashMap<K, V> map, S state, Func<S, K, V, S> folder) Source #

Atomically folds all items in the map (in order) using the folder function provided.

Parameters

type S

State type

param state

Initial state

param folder

Fold function

returns

Folded state

method S fold <S, K, V> (TrackingHashMap<K, V> map, S state, Func<S, V, S> folder) Source #

Atomically folds all items in the map (in order) using the folder function provided.

Parameters

type S

State type

param state

Initial state

param folder

Fold function

returns

Folded state

method bool exists <K, V> (TrackingHashMap<K, V> map, Func<K, V, bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool exists <K, V> (TrackingHashMap<K, V> map, Func<(K Key, V Value), bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool exists <K, V> (TrackingHashMap<K, V> map, Func<KeyValuePair<K, V>, bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool exists <K, V> (TrackingHashMap<K, V> map, Func<V, bool> pred) Source #

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

class TrackingHashMap Source #

Immutable tracking hash-map module

Methods

method TrackingHashMap<EqK, K, V> singleton <EqK, K, V> ((K, V) value) Source #

where EqK : Eq<K>

Creates a singleton TrackingHashMap

method TrackingHashMap<EqK, K, V> singleton <EqK, K, V> (K key, V value) Source #

where EqK : Eq<K>

Creates a singleton TrackingHashMap

method TrackingHashMap<EqK, K, V> empty <EqK, K, V> () Source #

where EqK : Eq<K>

Creates a new empty TrackingHashMap

method TrackingHashMap<EqK, K, V> create <EqK, K, V> () Source #

where EqK : Eq<K>

Creates a new empty TrackingHashMap

method TrackingHashMap<EqK, K, V> create <EqK, K, V> (Tuple<K, V> head, params Tuple<K, V>[] tail) Source #

where EqK : Eq<K>

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<EqK, K, V> create <EqK, K, V> ((K, V) head, params (K, V)[] tail) Source #

where EqK : Eq<K>

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<EqK, K, V> create <EqK, K, V> (KeyValuePair<K, V> head, params KeyValuePair<K,V>[] tail) Source #

where EqK : Eq<K>

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<EqK, K, V> createRange <EqK, K, V> (IEnumerable<Tuple<K, V>> keyValues) Source #

where EqK : Eq<K>

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<EqK, K, V> createRange <EqK, K, V> (IEnumerable<(K, V)> keyValues) Source #

where EqK : Eq<K>

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<EqK, K, V> createRange <EqK, K, V> (ReadOnlySpan<(K, V)> keyValues) Source #

where EqK : Eq<K>

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<EqK, K, V> createRange <EqK, K, V> (IEnumerable<KeyValuePair<K, V>> keyValues) Source #

where EqK : Eq<K>

Creates a new Map seeded with the keyValues provided

method TrackingHashMap<EqK, K, V> add <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key, V value) Source #

where EqK : Eq<K>

Atomically adds a new item to the map

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<EqK, K, V> tryAdd <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key, V value) Source #

where EqK : Eq<K>

Atomically adds a new item to the map. If the key already exists, then the new item is ignored

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<EqK, K, V> addOrUpdate <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key, V value) Source #

where EqK : Eq<K>

Atomically adds a new item to the map. If the key already exists, the new item replaces it.

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<EqK, K, V> addOrUpdate <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key, Func<V, V> Some, Func<V> None) Source #

where EqK : Eq<K>

Retrieve a value from the map by key, map it to a new value, put it back. If it doesn't exist, add a new one based on None result.

Parameters

param key

Key to find

returns

New map with the mapped value

method TrackingHashMap<EqK, K, V> addOrUpdate <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key, Func<V, V> Some, V None) Source #

where EqK : Eq<K>

Retrieve a value from the map by key, map it to a new value, put it back. If it doesn't exist, add a new one based on None result.

Parameters

param key

Key to find

returns

New map with the mapped value

method TrackingHashMap<EqK, K, V> addRange <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<Tuple<K, V>> keyValues) Source #

where EqK : Eq<K>

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> addRange <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<(K, V)> keyValues) Source #

where EqK : Eq<K>

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> addRange <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<KeyValuePair<K, V>> keyValues) Source #

where EqK : Eq<K>

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> tryAddRange <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<Tuple<K, V>> keyValues) Source #

where EqK : Eq<K>

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> tryAddRange <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<(K, V)> keyValues) Source #

where EqK : Eq<K>

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> tryAddRange <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<KeyValuePair<K, V>> keyValues) Source #

where EqK : Eq<K>

Atomically adds a range of items to the map. If any of the keys exist already then they're ignored.

Null is not allowed for a Key or a Value

Parameters

param range

Range of KeyValuePairs to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> addOrUpdateRange <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<Tuple<K, V>> range) Source #

where EqK : Eq<K>

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> addOrUpdateRange <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<(K, V)> range) Source #

where EqK : Eq<K>

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> addOrUpdateRange <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<KeyValuePair<K, V>> range) Source #

where EqK : Eq<K>

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of KeyValuePairs to add

returns

New Map with the items added

method TrackingHashMap<EqK, K, V> remove <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key) Source #

where EqK : Eq<K>

Atomically removes an item from the map If the key doesn't exists, the request is ignored.

Parameters

param key

Key

returns

New map with the item removed

method bool containsKey <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key) Source #

where EqK : Eq<K>

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool contains <EqK, K, V> (TrackingHashMap<EqK, K, V> map, KeyValuePair<K, V> kv) Source #

where EqK : Eq<K>

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool contains <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Tuple<K, V> kv) Source #

where EqK : Eq<K>

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool contains <EqK, K, V> (TrackingHashMap<EqK, K, V> map, (K, V) kv) Source #

where EqK : Eq<K>

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method TrackingHashMap<EqK, K, V> setItem <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key, V value) Source #

where EqK : Eq<K>

Atomically updates an existing item

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<EqK, K, V> trySetItem <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key, V value) Source #

where EqK : Eq<K>

Atomically updates an existing item, unless it doesn't exist, in which case it is ignored

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method TrackingHashMap<EqK, K, V> trySetItem <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key, Func<V, V> Some) Source #

where EqK : Eq<K>

Atomically sets an item by first retrieving it, applying a map (Some), and then putting it back. Silently fails if the value doesn't exist.

Parameters

param key

Key to set

param Some

delegate to map the existing value to a new one before setting

returns

New map with the item set

method TrackingHashMap<EqK, K, V> setItems <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<Tuple<K, V>> items) Source #

where EqK : Eq<K>

Atomically sets a series of items using the Tuples provided

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> setItems <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<(K, V)> items) Source #

where EqK : Eq<K>

Atomically sets a series of items using the Tuples provided

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> setItems <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<KeyValuePair<K, V>> items) Source #

where EqK : Eq<K>

Atomically sets a series of items using the KeyValuePairs provided

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> trySetItems <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<Tuple<K, V>> items) Source #

where EqK : Eq<K>

Atomically sets a series of items using the Tuples provided.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> trySetItems <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<(K, V)> items) Source #

where EqK : Eq<K>

Atomically sets a series of items using the Tuples provided.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> trySetItems <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<KeyValuePair<K, V>> items) Source #

where EqK : Eq<K>

Atomically sets a series of items using the KeyValuePairs provided. If any of the items don't exist then they're silently ignored.

Parameters

param items

Items to set

returns

New map with the items set

method TrackingHashMap<EqK, K, V> trySetItems <EqK, K, V> (TrackingHashMap<EqK, K, V> map, IEnumerable<K> keys, Func<V, V> Some) Source #

where EqK : Eq<K>

Atomically sets a series of items using the keys provided to find the items and the Some delegate maps to a new value. If the items don't exist then they're silently ignored.

Parameters

param keys

Keys of items to set

param Some

Function map the existing item to a new one

returns

New map with the items set

method Option<V> find <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key) Source #

where EqK : Eq<K>

Retrieve a value from the map by key

Parameters

param key

Key to find

returns

Found value

method IEnumerable<V> findSeq <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key) Source #

where EqK : Eq<K>

Retrieve a value from the map by key as an enumerable

Parameters

param key

Key to find

returns

Found value

method R find <EqK, K, V, R> (TrackingHashMap<EqK, K, V> map, K key, Func<V, R> Some, Func<R> None) Source #

where EqK : Eq<K>

Retrieve a value from the map by key and pattern match the result.

Parameters

param key

Key to find

returns

Found value

method TrackingHashMap<EqK, K, V> setItem <EqK, K, V> (TrackingHashMap<EqK, K, V> map, K key, Func<V, V> mapper) Source #

where EqK : Eq<K>

Retrieve a value from the map by key, map it to a new value, put it back.

Parameters

param key

Key to find

returns

New map with the mapped value

method Unit iter <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Action<V> action) Source #

where EqK : Eq<K>

Atomically iterate through all key/value pairs in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method Unit iter <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Action<K, V> action) Source #

where EqK : Eq<K>

Atomically iterate through all key/value pairs in the map (in order) and execute an action on each

Parameters

param action

Action to execute

returns

Unit

method bool forall <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Func<V, bool> pred) Source #

where EqK : Eq<K>

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool forall <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Func<K, V, bool> pred) Source #

where EqK : Eq<K>

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool forall <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Func<(K Key, V Value), bool> pred) Source #

where EqK : Eq<K>

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool forall <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Func<KeyValuePair<K, V>, bool> pred) Source #

where EqK : Eq<K>

Return true if all items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method TrackingHashMap<EqK, K, V> filter <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Func<V, bool> predicate) Source #

where EqK : Eq<K>

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method TrackingHashMap<EqK, K, V> filter <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Func<K, V, bool> predicate) Source #

where EqK : Eq<K>

Atomically filter out items that return false when a predicate is applied

Parameters

param pred

Predicate

returns

New map with items filtered

method int length <EqK, K, T> (TrackingHashMap<EqK, K, T> map) Source #

where EqK : Eq<K>

Number of items in the map

method S fold <EqK, S, K, V> (TrackingHashMap<EqK, K, V> map, S state, Func<S, K, V, S> folder) Source #

where EqK : Eq<K>

Atomically folds all items in the map (in order) using the folder function provided.

Parameters

type S

State type

param state

Initial state

param folder

Fold function

returns

Folded state

method S fold <EqK, S, K, V> (TrackingHashMap<EqK, K, V> map, S state, Func<S, V, S> folder) Source #

where EqK : Eq<K>

Atomically folds all items in the map (in order) using the folder function provided.

Parameters

type S

State type

param state

Initial state

param folder

Fold function

returns

Folded state

method bool exists <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Func<K, V, bool> pred) Source #

where EqK : Eq<K>

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool exists <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Func<(K Key, V Value), bool> pred) Source #

where EqK : Eq<K>

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool exists <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Func<KeyValuePair<K, V>, bool> pred) Source #

where EqK : Eq<K>

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied

method bool exists <EqK, K, V> (TrackingHashMap<EqK, K, V> map, Func<V, bool> pred) Source #

where EqK : Eq<K>

Return true if any items in the map return true when the predicate is applied

Parameters

param pred

Predicate

returns

True if all items in the map return true when the predicate is applied