- AtomHashMap <K, V>
- Empty
- this []
- IsEmpty
- Count
- Length
- ToReadOnlyDictionary ()
- Swap (Func<TrackingHashMap<K, V>, TrackingHashMap<K, V>> swap)
- SwapKey (K key, Func<V, V> swap)
- SwapKey (K key, Func<Option<V>, Option<V>> swap)
- Filter (Func<V, bool> pred)
- FilterInPlace (Func<V, bool> pred)
- Filter (Func<K, V, bool> pred)
- FilterInPlace (Func<K, V, bool> pred)
- MapInPlace (Func<V, V> f)
- Map <U> (Func<K, V, U> f)
- Add (K key, V value)
- TryAdd (K key, V value)
- AddOrUpdate (K key, V value)
- AddOrUpdate (K key, Func<V, V> Some, Func<V> None)
- AddOrUpdate (K key, Func<V, V> Some, V None)
- AddRange (IEnumerable<(K Key, V Value)> range)
- TryAddRange (IEnumerable<(K Key, V Value)> range)
- TryAddRange (IEnumerable<KeyValuePair<K, V>> range)
- AddOrUpdateRange (IEnumerable<(K Key, V Value)> range)
- AddOrUpdateRange (IEnumerable<KeyValuePair<K, V>> range)
- Remove (K key)
- Find (K value)
- FindSeq (K key)
- Find <R> (K key, Func<V, R> Some, Func<R> None)
- FindOrAdd (K key, Func<V> None)
- FindOrAdd (K key, V value)
- FindOrMaybeAdd (K key, Func<Option<V>> None)
- FindOrMaybeAdd (K key, Option<V> None)
- SetItem (K key, V value)
- SetItem (K key, Func<V, V> Some)
- TrySetItem (K key, V value)
- TrySetItem (K key, Func<V, V> Some)
- ContainsKey (K key)
- Contains (K key, V value)
- Contains (V value)
- Contains <EqV> (V value)
- Contains <EqV> (K key, V value)
- Clear ()
- AddRange (IEnumerable<KeyValuePair<K, V>> pairs)
- SetItems (IEnumerable<KeyValuePair<K, V>> items)
- SetItems (IEnumerable<(K Key, V Value)> items)
- TrySetItems (IEnumerable<KeyValuePair<K, V>> items)
- TrySetItems (IEnumerable<(K Key, V Value)> items)
- TrySetItems (IEnumerable<K> keys, Func<V, V> Some)
- RemoveRange (IEnumerable<K> keys)
- Contains (KeyValuePair<K, V> pair)
- Keys
- Values
- ToDictionary ()
- ToHashMap ()
- ToDictionary <KR, VR> ( Func<(K Key, V Value), KR> keySelector, Func<(K Key, V Value), VR> valueSelector)
- GetEnumerator ()
- ToSeq ()
- ToString ()
- ToFullString (string separator = ", ")
- ToFullArrayString (string separator = ", ")
- AsEnumerable ()
- == (AtomHashMap<K, V> lhs, AtomHashMap<K, V> rhs)
- == (AtomHashMap<K, V> lhs, HashMap<K, V> rhs)
- == (HashMap<K, V> lhs, AtomHashMap<K, V> rhs)
- != (AtomHashMap<K, V> lhs, AtomHashMap<K, V> rhs)
- != (AtomHashMap<K, V> lhs, HashMap<K, V> rhs)
- != (HashMap<K, V> lhs, AtomHashMap<K, V> rhs)
- Append (AtomHashMap<K, V> rhs)
- Append (HashMap<K, V> rhs)
- Subtract (AtomHashMap<K, V> rhs)
- Subtract (HashMap<K, V> rhs)
- IsProperSubsetOf (IEnumerable<(K Key, V Value)> other)
- IsProperSubsetOf (IEnumerable<K> other)
- IsProperSupersetOf (IEnumerable<(K Key, V Value)> other)
- IsProperSupersetOf (IEnumerable<K> other)
- IsSubsetOf (IEnumerable<(K Key, V Value)> other)
- IsSubsetOf (IEnumerable<K> other)
- IsSubsetOf (HashMap<K, V> other)
- IsSupersetOf (IEnumerable<(K Key, V Value)> other)
- IsSupersetOf (IEnumerable<K> rhs)
- Intersect (IEnumerable<K> rhs)
- Intersect (IEnumerable<(K Key, V Value)> rhs)
- Intersect (IEnumerable<(K Key, V Value)> rhs, WhenMatched<K, V, V, V> Merge)
- Intersect (HashMap<K, V> rhs, WhenMatched<K, V, V, V> Merge)
- Overlaps (IEnumerable<(K Key, V Value)> other)
- Overlaps (IEnumerable<K> other)
- Except (IEnumerable<K> rhs)
- Except (IEnumerable<(K Key, V Value)> rhs)
- SymmetricExcept (HashMap<K, V> rhs)
- SymmetricExcept (IEnumerable<(K Key, V Value)> rhs)
- Union (IEnumerable<(K, V)> rhs)
- Union (IEnumerable<(K Key, V Value)> rhs, WhenMatched<K, V, V, V> Merge)
- Union <W> (IEnumerable<(K Key, W Value)> rhs, WhenMissing<K, W, V> MapRight, WhenMatched<K, V, W, V> Merge)
- Equals (object? obj)
- Equals (AtomHashMap<K, V>? other)
- Equals (HashMap<K, V> other)
- EqualsKeys (AtomHashMap<K, V> other)
- EqualsKeys (HashMap<K, V> other)
- GetHashCode ()
- Select <U> (Func<V, U> f)
- Select <U> (Func<K, V, U> f)
- Where (Func<V, bool> pred)
- Where (Func<K, V, bool> pred)
- ForAll (Func<K, V, bool> pred)
- ForAll (Func<(K Key, V Value), bool> pred)
- ForAll (Func<KeyValuePair<K, V>, bool> pred)
- ForAll (Func<V, bool> pred)
- Exists (Func<K, V, bool> pred)
- Exists (Func<Tuple<K, V>, bool> pred)
- Exists (Func<(K Key, V Value), bool> pred)
- Exists (Func<KeyValuePair<K, V>, bool> pred)
- Exists (Func<V, bool> pred)
- Iter (Action<K, V> action)
- Iter (Action<V> action)
- Iter (Action<(K Key, V Value)> action)
- Iter (Action<KeyValuePair<K, V>> action)
- Fold <S> (S state, Func<S, K, V, S> folder)
- Fold <S> (S state, Func<S, V, S> folder)
- AtomHashMap <EqK, K, V>
- Empty
- this []
- IsEmpty
- Count
- Length
- ToReadOnlyDictionary ()
- Swap (Func<TrackingHashMap<EqK, K, V>, TrackingHashMap<EqK, K, V>> swap)
- SwapKey (K key, Func<V, V> swap)
- SwapKey (K key, Func<Option<V>, Option<V>> swap)
- Filter (Func<V, bool> pred)
- FilterInPlace (Func<V, bool> pred)
- Filter (Func<K, V, bool> pred)
- FilterInPlace (Func<K, V, bool> pred)
- MapInPlace (Func<V, V> f)
- Map <U> (Func<K, V, U> f)
- Add (K key, V value)
- TryAdd (K key, V value)
- AddOrUpdate (K key, V value)
- AddOrUpdate (K key, Func<V, V> Some, Func<V> None)
- AddOrUpdate (K key, Func<V, V> Some, V None)
- AddRange (IEnumerable<(K Key, V Value)> range)
- TryAddRange (IEnumerable<(K Key, V Value)> range)
- TryAddRange (IEnumerable<KeyValuePair<K, V>> range)
- AddOrUpdateRange (IEnumerable<(K Key, V Value)> range)
- AddOrUpdateRange (IEnumerable<KeyValuePair<K, V>> range)
- Remove (K key)
- Find (K value)
- FindSeq (K key)
- Find <R> (K key, Func<V, R> Some, Func<R> None)
- FindOrAdd (K key, Func<V> None)
- FindOrAdd (K key, V value)
- FindOrMaybeAdd (K key, Func<Option<V>> None)
- FindOrMaybeAdd (K key, Option<V> None)
- SetItem (K key, V value)
- SetItem (K key, Func<V, V> Some)
- TrySetItem (K key, V value)
- TrySetItem (K key, Func<V, V> Some)
- ContainsKey (K key)
- Contains (K key, V value)
- Contains (V value)
- Contains <EqV> (V value)
- Contains <EqV> (K key, V value)
- Clear ()
- AddRange (IEnumerable<KeyValuePair<K, V>> pairs)
- SetItems (IEnumerable<KeyValuePair<K, V>> items)
- SetItems (IEnumerable<(K Key, V Value)> items)
- TrySetItems (IEnumerable<KeyValuePair<K, V>> items)
- TrySetItems (IEnumerable<(K Key, V Value)> items)
- TrySetItems (IEnumerable<K> keys, Func<V, V> Some)
- RemoveRange (IEnumerable<K> keys)
- Contains (KeyValuePair<K, V> pair)
- Keys
- Values
- ToDictionary ()
- ToHashMap ()
- ToDictionary <KR, VR> ( Func<(K Key, V Value), KR> keySelector, Func<(K Key, V Value), VR> valueSelector)
- GetEnumerator ()
- ToSeq ()
- ToString ()
- ToFullString (string separator = ", ")
- ToFullArrayString (string separator = ", ")
- AsEnumerable ()
- == (AtomHashMap<EqK, K, V> lhs, AtomHashMap<EqK, K, V> rhs)
- == (AtomHashMap<EqK, K, V> lhs, HashMap<EqK, K, V> rhs)
- == (HashMap<EqK, K, V> lhs, AtomHashMap<EqK, K, V> rhs)
- != (AtomHashMap<EqK, K, V> lhs, AtomHashMap<EqK, K, V> rhs)
- != (AtomHashMap<EqK, K, V> lhs, HashMap<EqK, K, V> rhs)
- != (HashMap<EqK, K, V> lhs, AtomHashMap<EqK, K, V> rhs)
- Append (AtomHashMap<EqK, K, V> rhs)
- Append (HashMap<EqK, K, V> rhs)
- Subtract (AtomHashMap<EqK, K, V> rhs)
- Subtract (HashMap<EqK, K, V> rhs)
- IsProperSubsetOf (IEnumerable<(K Key, V Value)> other)
- IsProperSubsetOf (IEnumerable<K> other)
- IsProperSupersetOf (IEnumerable<(K Key, V Value)> other)
- IsProperSupersetOf (IEnumerable<K> other)
- IsSubsetOf (IEnumerable<(K Key, V Value)> other)
- IsSubsetOf (IEnumerable<K> other)
- IsSubsetOf (HashMap<EqK, K, V> other)
- IsSupersetOf (IEnumerable<(K Key, V Value)> other)
- IsSupersetOf (IEnumerable<K> rhs)
- Intersect (IEnumerable<K> rhs)
- Intersect (IEnumerable<(K Key, V Value)> rhs)
- Intersect (IEnumerable<(K Key, V Value)> rhs, WhenMatched<K, V, V, V> Merge)
- Intersect (HashMap<EqK, K, V> rhs, WhenMatched<K, V, V, V> Merge)
- Overlaps (IEnumerable<(K Key, V Value)> other)
- Overlaps (IEnumerable<K> other)
- Except (IEnumerable<K> rhs)
- Except (IEnumerable<(K Key, V Value)> rhs)
- SymmetricExcept (HashMap<EqK, K, V> rhs)
- SymmetricExcept (IEnumerable<(K Key, V Value)> rhs)
- Union (IEnumerable<(K, V)> rhs)
- Union (IEnumerable<(K Key, V Value)> rhs, WhenMatched<K, V, V, V> Merge)
- Union <W> (IEnumerable<(K Key, W Value)> rhs, WhenMissing<K, W, V> MapRight, WhenMatched<K, V, W, V> Merge)
- Equals (object? obj)
- Equals (AtomHashMap<EqK, K, V>? other)
- Equals (HashMap<EqK, K, V> other)
- EqualsKeys (AtomHashMap<EqK, K, V> other)
- EqualsKeys (HashMap<EqK, K, V> other)
- GetHashCode ()
- Select <U> (Func<V, U> f)
- Select <U> (Func<K, V, U> f)
- Where (Func<V, bool> pred)
- Where (Func<K, V, bool> pred)
- ForAll (Func<K, V, bool> pred)
- ForAll (Func<(K Key, V Value), bool> pred)
- ForAll (Func<KeyValuePair<K, V>, bool> pred)
- ForAll (Func<V, bool> pred)
- Exists (Func<K, V, bool> pred)
- Exists (Func<Tuple<K, V>, bool> pred)
- Exists (Func<(K Key, V Value), bool> pred)
- Exists (Func<KeyValuePair<K, V>, bool> pred)
- Exists (Func<V, bool> pred)
- Iter (Action<K, V> action)
- Iter (Action<V> action)
- Iter (Action<(K Key, V Value)> action)
- Iter (Action<KeyValuePair<K, V>> action)
- Fold <S> (S state, Func<S, K, V, S> folder)
- Fold <S> (S state, Func<S, V, S> folder)
- AtomHashMap
- AtomHashMap
- AtomHashMapChangeEvent <K, V>
- AtomHashMapChangeEvent <EqK, K, V>
class AtomHashMap <K, V> Source #
Atoms provide a way to manage shared, synchronous, independent state without
locks. AtomHashMap
wraps the language-ext HashMap
, and makes sure all operations are atomic and thread-safe
without resorting to locking
See the concurrency section of the wiki for more info.
method IReadOnlyDictionary<K, V> ToReadOnlyDictionary () Source #
Get a IReadOnlyDictionary for this map. No mapping is required, so this is very fast.
method Unit Swap (Func<TrackingHashMap<K, V>, TrackingHashMap<K, V>> swap) Source #
Atomically swap the underlying hash-map. Allows for multiple operations on the hash-map in an entirely transactional and atomic way.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
NOTE: The change-tracking only works if you transform the TrackingHashMap
provided to the Func
. If you
build a fresh one then it won't have any tracking. You can call map.Clear()
to get to an empty
map, which will also track the removals.
param | swap | Swap function, maps the current state of the AtomHashMap to a new state |
method Unit SwapKey (K key, Func<V, V> swap) Source #
Atomically swap a key in the hash-map, if it exists. If it doesn't exist, nothing changes. Allows for multiple operations on the hash-map value in an entirely transactional and atomic way.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | swap | Swap function, maps the current state of a value in the AtomHashMap to a new value |
method Unit SwapKey (K key, Func<Option<V>, Option<V>> swap) Source #
Atomically swap a key in the hash-map:
- If the key doesn't exist, then
None
is passed toswap
- If the key does exist, then
Some(x)
is passed toswap
The operation performed on the hash-map depends on the value going in and out of swap
:
In | Out | Operation |
---|---|---|
Some(x) |
Some(y) |
SetItem(key, y) |
Some(x) |
None |
Remove(key) |
None |
Some(y) |
Add(key, y) |
None |
None |
no-op |
Allows for multiple operations on the hash-map value in an entirely transactional and atomic way.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | swap | Swap function, maps the current state of a value in the AtomHashMap to a new value |
method AtomHashMap<K, V> Filter (Func<V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
param | pred | Predicate |
returns | New map with items filtered |
method Unit FilterInPlace (Func<V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | pred | Predicate |
returns | New map with items filtered |
method AtomHashMap<K, V> Filter (Func<K, V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
param | pred | Predicate |
method Unit FilterInPlace (Func<K, V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | pred | Predicate |
method Unit MapInPlace (Func<V, V> f) Source #
Atomically maps the map to a new map
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
returns | Mapped items in a new map |
method AtomHashMap<K, U> Map <U> (Func<K, V, U> f) Source #
Atomically maps the map to a new map
returns | Mapped items in a new map |
method Unit Add (K key, V value) Source #
Atomically adds a new item to the map
Null is not allowed for a Key or a Value
param | key | Key |
param | value | Value |
method Unit 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
param | key | Key |
param | value | Value |
method Unit 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
param | key | Key |
param | value | Value |
method Unit 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to find |
method Unit 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to find |
method Unit 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
param | range | Range of tuples to add |
method Unit 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
param | range | Range of tuples to add |
method Unit 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
param | range | Range of KeyValuePairs to add |
method Unit 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
param | range | Range of tuples to add |
returns | New Map with the items added |
method Unit 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
param | range | Range of KeyValuePairs to add |
method Unit Remove (K key) Source #
Atomically removes an item from the map If the key doesn't exists, the request is ignored.
param | key | Key |
method Option<V> Find (K value) Source #
Retrieve a value from the map by key
param | key | Key to find |
returns | Found value |
method IEnumerable<V> FindSeq (K key) Source #
Retrieve a value from the map by key as an enumerable
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.
param | key | Key to find |
returns | Found value |
method V 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to find |
param | None | Delegate to get the value |
returns | Added value |
method V FindOrAdd (K key, V value) Source #
Try to find the key in the map, if it doesn't exist, add a new item provided.
param | key | Key to find |
param | value | Delegate to get the value |
returns | Added value |
method Option<V> 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to find |
param | None | Delegate to get the value |
returns | Added value |
method Option<V> 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.
param | key | Key to find |
param | None | Delegate to get the value |
returns | Added value |
method Unit SetItem (K key, V value) Source #
Atomically updates an existing item
Null is not allowed for a Key or a Value
param | key | Key |
param | value | Value |
method Unit 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to set |
method Unit 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
param | key | Key |
param | value | Value |
method Unit 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
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to set |
param | Some | delegate to map the existing value to a new one before setting |
method bool ContainsKey (K key) Source #
Checks for existence of a key in the map
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
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
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 #
Checks for existence of a value in the map
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 #
Checks for existence of a key in the map
param | key | Key to check |
returns | True if an item with the key supplied is in the map |
method Unit AddRange (IEnumerable<KeyValuePair<K, V>> pairs) Source #
Atomically adds a range of items to the map
param | pairs | Range of KeyValuePairs to add |
method Unit SetItems (IEnumerable<KeyValuePair<K, V>> items) Source #
Atomically sets a series of items using the KeyValuePairs provided
param | items | Items to set |
method Unit SetItems (IEnumerable<(K Key, V Value)> items) Source #
Atomically sets a series of items using the Tuples provided.
param | items | Items to set |
method Unit 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.
param | items | Items to set |
method Unit 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.
param | items | Items to set |
method Unit 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | keys | Keys of items to set |
param | Some | Function map the existing item to a new one |
method Unit RemoveRange (IEnumerable<K> keys) Source #
Atomically removes a set of keys from the map
param | keys | Keys to remove |
method bool Contains (KeyValuePair<K, V> pair) Source #
Returns true if a Key/Value pair exists in the map
param | pair | Pair to find |
returns | True if exists, false otherwise |
method IReadOnlyDictionary<K, V> ToDictionary () Source #
Convert the map to an IDictionary
This is effectively a zero cost operation, not even a single allocation
method HashMap<K, V> ToHashMap () Source #
Convert to a HashMap
This is effectively a zero cost operation, not even a single allocation
method IDictionary<KR, VR> ToDictionary <KR, VR> ( Func<(K Key, V Value), KR> keySelector, Func<(K Key, V Value), VR> valueSelector) Source #
Map the map the a dictionary
method IEnumerator<(K Key, V Value)> GetEnumerator () Source #
GetEnumerator - IEnumerable interface
method string ToString () Source #
Format the collection as [(key: value), (key: value), (key: value), ...]
The ellipsis 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 IEnumerable<(K Key, V Value)> AsEnumerable () Source #
method bool IsProperSubsetOf (IEnumerable<(K Key, V Value)> other) Source #
Returns True if 'other' is a proper subset of this set
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
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
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
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
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
returns | True if 'other' is a superset of this set |
method bool IsSubsetOf (HashMap<K, V> other) Source #
Returns True if 'other' is a superset of this set
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
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
returns | True if 'other' is a superset of this set |
method Unit Intersect (IEnumerable<K> rhs) Source #
Returns the elements that are in both this and other
method Unit Intersect (IEnumerable<(K Key, V Value)> rhs) Source #
Returns the elements that are in both this and other
method Unit 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 Unit Intersect (HashMap<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 Unit Except (IEnumerable<K> rhs) Source #
Returns this - rhs. Only the items in this that are not in rhs will be returned.
method Unit 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 Unit SymmetricExcept (HashMap<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 Unit 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 Unit Union (IEnumerable<(K, V)> rhs) Source #
Finds the union of two sets and produces a new set with the results
param | other | Other set to union with |
returns | A set which contains all items from both sets |
method Unit Union (IEnumerable<(K Key, V Value)> rhs, 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 Unit Union <W> (IEnumerable<(K Key, W Value)> rhs, 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 (AtomHashMap<K, V>? other) Source #
Equality of keys and values with EqDefault<V>
used for values
method bool Equals (HashMap<K, V> other) Source #
Equality of keys and values with EqDefault<V>
used for values
method bool EqualsKeys (AtomHashMap<K, V> other) Source #
Equality of keys only
method bool EqualsKeys (HashMap<K, V> other) Source #
Equality of keys only
method int GetHashCode () Source #
method AtomHashMap<K, U> Select <U> (Func<V, U> f) Source #
Atomically maps the map to a new map
returns | Mapped items in a new map |
method AtomHashMap<K, U> Select <U> (Func<K, V, U> f) Source #
Atomically maps the map to a new map
returns | Mapped items in a new map |
method AtomHashMap<K, V> Where (Func<V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
param | pred | Predicate |
returns | New map with items filtered |
method AtomHashMap<K, V> Where (Func<K, V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
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
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
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
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
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
param | pred | Predicate |
returns | True if all items in the map return true when the predicate is applied |
method bool Exists (Func<Tuple<K, V>, bool> pred) Source #
Return true if any items in the map return true when the predicate is applied
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
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
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
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
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
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
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
param | action | Action to execute |
returns | Unit |
operator == (AtomHashMap<K, V> lhs, AtomHashMap<K, V> rhs) Source #
Equality of keys and values with EqDefault<V>
used for values
operator == (AtomHashMap<K, V> lhs, HashMap<K, V> rhs) Source #
Equality of keys and values with EqDefault<V>
used for values
operator == (HashMap<K, V> lhs, AtomHashMap<K, V> rhs) Source #
Equality of keys and values with EqDefault<V>
used for values
operator != (AtomHashMap<K, V> lhs, AtomHashMap<K, V> rhs) Source #
In-equality of keys and values with EqDefault<V>
used for values
class AtomHashMap <EqK, K, V> Source #
Atoms provide a way to manage shared, synchronous, independent state without
locks. AtomHashMap
wraps the language-ext HashMap
, and makes sure all operations are atomic and thread-safe
without resorting to locking
See the concurrency section of the wiki for more info.
method IReadOnlyDictionary<K, V> ToReadOnlyDictionary () Source #
Get a IReadOnlyDictionary for this map. No mapping is required, so this is very fast.
method Unit Swap (Func<TrackingHashMap<EqK, K, V>, TrackingHashMap<EqK, K, V>> swap) Source #
Atomically swap the underlying hash-map. Allows for multiple operations on the hash-map in an entirely transactional and atomic way.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
NOTE: The change-tracking only works if you transform the TrackingHashMap
provided to the Func
. If you
build a fresh one then it won't have any tracking. You can call map.Clear()
to get to an empty
map, which will also track the removals.
param | swap | Swap function, maps the current state of the AtomHashMap to a new state |
method Unit SwapKey (K key, Func<V, V> swap) Source #
Atomically swap a key in the hash-map, if it exists. If it doesn't exist, nothing changes. Allows for multiple operations on the hash-map value in an entirely transactional and atomic way.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | swap | Swap function, maps the current state of a value in the AtomHashMap to a new value |
method Unit SwapKey (K key, Func<Option<V>, Option<V>> swap) Source #
Atomically swap a key in the hash-map:
- If the key doesn't exist, then
None
is passed toswap
- If the key does exist, then
Some(x)
is passed toswap
The operation performed on the hash-map depends on the value going in and out of swap
:
In | Out | Operation |
---|---|---|
Some(x) |
Some(y) |
SetItem(key, y) |
Some(x) |
None |
Remove(key) |
None |
Some(y) |
Add(key, y) |
None |
None |
no-op |
Allows for multiple operations on the hash-map value in an entirely transactional and atomic way.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | swap | Swap function, maps the current state of a value in the AtomHashMap to a new value |
method AtomHashMap<EqK, K, V> Filter (Func<V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
param | pred | Predicate |
returns | New map with items filtered |
method Unit FilterInPlace (Func<V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | pred | Predicate |
returns | New map with items filtered |
method AtomHashMap<EqK, K, V> Filter (Func<K, V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
param | pred | Predicate |
method Unit FilterInPlace (Func<K, V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | pred | Predicate |
method Unit MapInPlace (Func<V, V> f) Source #
Atomically maps the map to a new map
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
returns | Mapped items in a new map |
method AtomHashMap<EqK, K, U> Map <U> (Func<K, V, U> f) Source #
Atomically maps the map to a new map
returns | Mapped items in a new map |
method Unit Add (K key, V value) Source #
Atomically adds a new item to the map
Null is not allowed for a Key or a Value
param | key | Key |
param | value | Value |
method Unit 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
param | key | Key |
param | value | Value |
method Unit 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
param | key | Key |
param | value | Value |
method Unit 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to find |
method Unit 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to find |
method Unit 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
param | range | Range of tuples to add |
method Unit 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
param | range | Range of tuples to add |
method Unit 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
param | range | Range of KeyValuePairs to add |
method Unit 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
param | range | Range of tuples to add |
returns | New Map with the items added |
method Unit 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
param | range | Range of KeyValuePairs to add |
method Unit Remove (K key) Source #
Atomically removes an item from the map If the key doesn't exists, the request is ignored.
param | key | Key |
method Option<V> Find (K value) Source #
Retrieve a value from the map by key
param | key | Key to find |
returns | Found value |
method IEnumerable<V> FindSeq (K key) Source #
Retrieve a value from the map by key as an enumerable
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.
param | key | Key to find |
returns | Found value |
method V 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to find |
param | None | Delegate to get the value |
returns | Added value |
method V FindOrAdd (K key, V value) Source #
Try to find the key in the map, if it doesn't exist, add a new item provided.
param | key | Key to find |
param | value | Delegate to get the value |
returns | Added value |
method Option<V> 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to find |
param | None | Delegate to get the value |
returns | Added value |
method Option<V> 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.
param | key | Key to find |
param | None | Delegate to get the value |
returns | Added value |
method Unit SetItem (K key, V value) Source #
Atomically updates an existing item
Null is not allowed for a Key or a Value
param | key | Key |
param | value | Value |
method Unit 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to set |
method Unit 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
param | key | Key |
param | value | Value |
method Unit 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
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | key | Key to set |
param | Some | delegate to map the existing value to a new one before setting |
method bool ContainsKey (K key) Source #
Checks for existence of a key in the map
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
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
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 #
Checks for existence of a value in the map
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 #
Checks for existence of a key in the map
param | key | Key to check |
returns | True if an item with the key supplied is in the map |
method Unit AddRange (IEnumerable<KeyValuePair<K, V>> pairs) Source #
Atomically adds a range of items to the map
param | pairs | Range of KeyValuePairs to add |
method Unit SetItems (IEnumerable<KeyValuePair<K, V>> items) Source #
Atomically sets a series of items using the KeyValuePairs provided
param | items | Items to set |
method Unit SetItems (IEnumerable<(K Key, V Value)> items) Source #
Atomically sets a series of items using the Tuples provided.
param | items | Items to set |
method Unit 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.
param | items | Items to set |
method Unit 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.
param | items | Items to set |
method Unit 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.
Any functions passed as arguments may be run multiple times if there are multiple threads competing to update this data structure. Therefore the functions must spend as little time performing the injected behaviours as possible to avoid repeated attempts
param | keys | Keys of items to set |
param | Some | Function map the existing item to a new one |
method Unit RemoveRange (IEnumerable<K> keys) Source #
Atomically removes a set of keys from the map
param | keys | Keys to remove |
method bool Contains (KeyValuePair<K, V> pair) Source #
Returns true if a Key/Value pair exists in the map
param | pair | Pair to find |
returns | True if exists, false otherwise |
method IReadOnlyDictionary<K, V> ToDictionary () Source #
Convert the map to an IDictionary
This is effectively a zero cost operation, not even a single allocation
method HashMap<EqK, K, V> ToHashMap () Source #
Convert to a HashMap
This is effectively a zero cost operation, not even a single allocation
method IDictionary<KR, VR> ToDictionary <KR, VR> ( Func<(K Key, V Value), KR> keySelector, Func<(K Key, V Value), VR> valueSelector) Source #
Map the map the a dictionary
method IEnumerator<(K Key, V Value)> GetEnumerator () Source #
GetEnumerator - IEnumerable interface
method string ToString () Source #
Format the collection as [(key: value), (key: value), (key: value), ...]
The ellipsis 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 IEnumerable<(K Key, V Value)> AsEnumerable () Source #
method bool IsProperSubsetOf (IEnumerable<(K Key, V Value)> other) Source #
Returns True if 'other' is a proper subset of this set
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
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
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
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
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
returns | True if 'other' is a superset of this set |
method bool IsSubsetOf (HashMap<EqK, K, V> other) Source #
Returns True if 'other' is a superset of this set
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
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
returns | True if 'other' is a superset of this set |
method Unit Intersect (IEnumerable<K> rhs) Source #
Returns the elements that are in both this and other
method Unit Intersect (IEnumerable<(K Key, V Value)> rhs) Source #
Returns the elements that are in both this and other
method Unit 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 Unit Intersect (HashMap<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 Unit Except (IEnumerable<K> rhs) Source #
Returns this - rhs. Only the items in this that are not in rhs will be returned.
method Unit 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 Unit SymmetricExcept (HashMap<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 Unit 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 Unit Union (IEnumerable<(K, V)> rhs) Source #
Finds the union of two sets and produces a new set with the results
param | other | Other set to union with |
returns | A set which contains all items from both sets |
method Unit Union (IEnumerable<(K Key, V Value)> rhs, 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 Unit Union <W> (IEnumerable<(K Key, W Value)> rhs, 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 (AtomHashMap<EqK, K, V>? other) Source #
Equality of keys and values with EqDefault<V>
used for values
method bool Equals (HashMap<EqK, K, V> other) Source #
Equality of keys and values with EqDefault<V>
used for values
method bool EqualsKeys (AtomHashMap<EqK, K, V> other) Source #
Equality of keys only
method bool EqualsKeys (HashMap<EqK, K, V> other) Source #
Equality of keys only
method int GetHashCode () Source #
method AtomHashMap<EqK, K, U> Select <U> (Func<V, U> f) Source #
Atomically maps the map to a new map
returns | Mapped items in a new map |
method AtomHashMap<EqK, K, U> Select <U> (Func<K, V, U> f) Source #
Atomically maps the map to a new map
returns | Mapped items in a new map |
method AtomHashMap<EqK, K, V> Where (Func<V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
param | pred | Predicate |
returns | New map with items filtered |
method AtomHashMap<EqK, K, V> Where (Func<K, V, bool> pred) Source #
Atomically filter out items that return false when a predicate is applied
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
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
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
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
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
param | pred | Predicate |
returns | True if all items in the map return true when the predicate is applied |
method bool Exists (Func<Tuple<K, V>, bool> pred) Source #
Return true if any items in the map return true when the predicate is applied
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
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
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
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
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
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
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
param | action | Action to execute |
returns | Unit |
operator == (AtomHashMap<EqK, K, V> lhs, AtomHashMap<EqK, K, V> rhs) Source #
Equality of keys and values with EqDefault<V>
used for values
operator == (AtomHashMap<EqK, K, V> lhs, HashMap<EqK, K, V> rhs) Source #
Equality of keys and values with EqDefault<V>
used for values
operator == (HashMap<EqK, K, V> lhs, AtomHashMap<EqK, K, V> rhs) Source #
Equality of keys and values with EqDefault<V>
used for values
operator != (AtomHashMap<EqK, K, V> lhs, AtomHashMap<EqK, K, V> rhs) Source #
In-equality of keys and values with EqDefault<V>
used for values
class AtomHashMap Source #
Atoms provide a way to manage shared, synchronous, independent state without
locks. AtomHashMap
wraps the language-ext HashMap
, and makes sure all operations are atomic and thread-safe
without resorting to locking
See the concurrency section of the wiki for more info.
class AtomHashMap Source #
Atoms provide a way to manage shared, synchronous, independent state without
locks. AtomHashMap
wraps the language-ext HashMap
, and makes sure all operations are atomic and thread-safe
without resorting to locking
See the concurrency section of the wiki for more info.
delegate AtomHashMapChangeEvent <K, V> Source #
Event sent from the AtomHashMap
type whenever an operation successfully modifies the underlying data
type | K | Key type |
type | V | Value type |
delegate AtomHashMapChangeEvent <EqK, K, V> Source #
Event sent from the AtomHashMap
type whenever an operation successfully modifies the underlying data
type | K | Key type |
type | V | Value type |