LanguageExt.Core

LanguageExt.Core Immutable Collections HashMap

Contents

struct HashMap <K, V> Source #

Unsorted immutable hash-map

Parameters

type K

Key type

type V

Value

Indexers

this [ V ] Source #

'this' accessor

Parameters

param key

Key

returns

Optional value

Properties

property HashMap<K, V> Empty Source #

property bool IsEmpty Source #

Is the map empty

property int Count Source #

Number of items in the map

property Iterable<K> Keys Source #

Enumerable of map keys

property Iterable<V> Values Source #

Enumerable of map values

property HashMap<K, V> AdditiveIdentity Source #

Constructors

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

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

Methods

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

Item at index lens

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

Item or none at index lens

method Lens<HashMap<K, V>, HashMap<K, B>> map <B> (Lens<V, B> lens) Source #

Lens map

method HashMap<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 HashMap<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 HashMap<K, U> Map <U> (Func<V, U> mapper) Source #

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<K, U> Map <U> (Func<K, V, U> mapper) Source #

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<K, V> Add (K key, V valueToAdd) Source #

Atomically adds a new item to the map

Null is not allowed for a Key or a Value

Parameters

param key

Key

param valueToAdd

Value

returns

New Map with the item added

method HashMap<K, V> TryAdd (K key, V valueToAdd) 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 valueToAdd

Value

returns

New Map with the item added

method HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 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 (HashMap<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 (HashMap<K, V>, V Value) FindOrAdd (K key, V valueToFindOrAdd) 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 valueToFindOrAdd

value

returns

Updated map and added value

method (HashMap<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 (HashMap<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 HashMap<K, V> SetItem (K key, V valueToSet) Source #

Atomically updates an existing item

Null is not allowed for a Key or a Value

Parameters

param key

Key

param valueToSet

Value

returns

New Map with the item added

method HashMap<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 HashMap<K, V> TrySetItem (K key, V valueToSet) 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 valueToSet

Value

returns

New Map with the item added

method HashMap<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 and value in the map

Parameters

param key

Key to check

param value

Value to check

returns

True if an item with the key 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 and value in the map

Parameters

param key

Key to check

param value

Value to check

returns

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

method HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 ((K Key, V Value) 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 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 HashMap<K, V> ToTrackingHashMap () Source #

Allocation free conversion to a TrackingHashMap

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)> AsIterable () Source #

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

method HashMap<K, V> Subtract (HashMap<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 (HashMap<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 HashMap<K, V> Intersect (IEnumerable<K> rhs) Source #

Returns the elements that are in both this and other

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

Returns the elements that are in both this and other

method HashMap<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 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 HashMap<K, V> Except (IEnumerable<K> rhs) Source #

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

method HashMap<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 HashMap<K, V> 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 HashMap<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 HashMap<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 HashMap<K, V> Union (IEnumerable<(K, V)> 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 HashMap<K, V> Union <W> (IEnumerable<(K, W)> 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 HashMap<K, W> Union <W> (IEnumerable<(K, W)> other, WhenMissing<K, V, W> MapLeft, WhenMatched<K, V, W, W> 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 left-hand side, but not the right-hand-side. This allows the V value-type to be mapped to the target V2 value-type.

method HashMap<K, R> Union <W, R> (IEnumerable<(K, W)> other, WhenMissing<K, V, R> MapLeft, WhenMissing<K, W, R> MapRight, WhenMatched<K, V, W, R> 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 MapLeft function is called when there is a key in the left-hand side, but not the right-hand-side. This allows the V value-type to be mapped to the target R value-type.

The WhenMissing MapRight 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 R value-type.

method bool Equals (object? obj) 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 Equals <EqV> (HashMap<K, V> other) Source #

where EqV : Eq<V>

Equality of keys and values with EqV used for values

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

Equality of keys only

method int GetHashCode () Source #

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

Impure iteration of the bound values in the structure

Parameters

returns

Returns the original unmodified structure

method HashMap<K, U> Select <U> (Func<V, U> mapper) Source #

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<K, U> Select <U> (Func<K, V, U> mapper) Source #

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<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 HashMap<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 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 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<(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 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 == (HashMap<K, V> lhs, HashMap<K, V> rhs) Source #

Equality of keys and values with EqDefault〈V〉 used for values

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

In-equality of keys and values with EqDefault〈V〉 used for values

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

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

struct HashMap <EqK, K, V> Source #

where EqK : Eq<K>

Unsorted immutable hash-map

Parameters

type K

Key type

type V

Value

Indexers

this [ V ] Source #

'this' accessor

Parameters

param key

Key

returns

Optional value

Properties

property HashMap<EqK, K, V> Empty 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

property HashMap<EqK, K, V> AdditiveIdentity Source #

Constructors

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

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

Methods

method HashMap<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 HashMap<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 HashMap<EqK, K, U> Map <U> (Func<V, U> mapper) Source #

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<EqK, K, U> Map <U> (Func<K, V, U> mapper) Source #

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<EqK, K, V> AddRange (IEnumerable<(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 HashMap<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 HashMap<EqK, K, V> TryAddRange (IEnumerable<(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 HashMap<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 HashMap<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 HashMap<EqK, K, V> AddOrUpdateRange (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.

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 HashMap<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 HashMap<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 (HashMap<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 (HashMap<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 (HashMap<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 (HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 <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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<EqK, K, V> SetItems (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 HashMap<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 HashMap<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 HashMap<EqK, K, V> TrySetItems (IEnumerable<(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 HashMap<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 HashMap<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 bool Contains <EqV> (KeyValuePair<K, V> pair) Source #

where EqV : Eq<V>

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

Parameters

param pair

Pair to find

returns

True if exists, false otherwise

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> ToTrackingHashMap () Source #

Allocation free conversion to a TrackingHashMap

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 HashMap<EqK, K, V> Combine (HashMap<EqK, K, V> rhs) Source #

method HashMap<EqK, K, V> Subtract (HashMap<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 (HashMap<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 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 HashMap<EqK, K, V> Intersect (IEnumerable<K> rhs) Source #

Returns the elements that are in both this and other

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

Returns the elements that are in both this and other

method HashMap<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 HashMap<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 HashMap<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 HashMap<EqK, K, V> 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 HashMap<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 HashMap<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 HashMap<EqK, K, V> Union (IEnumerable<(K, V)> 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 HashMap<EqK, K, V> Union <W> ( IEnumerable<(K, W)> 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 HashMap<EqK, K, W> Union <W> ( IEnumerable<(K, W)> other, WhenMissing<K, V, W> MapLeft, WhenMatched<K, V, W, W> 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 left-hand side, but not the right-hand-side. This allows the V value-type to be mapped to the target V2 value-type.

method HashMap<EqK, K, R> Union <W, R> ( IEnumerable<(K, W)> other, WhenMissing<K, V, R> MapLeft, WhenMissing<K, W, R> MapRight, WhenMatched<K, V, W, R> 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 MapLeft function is called when there is a key in the left-hand side, but not the right-hand-side. This allows the V value-type to be mapped to the target R value-type.

The WhenMissing MapRight 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 R value-type.

method bool Equals (object? obj) Source #

Equality of keys

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

Equality of keys and values with EqDefault〈V〉 used for values

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

where EqV : Eq<V>

Equality of keys and values

method bool EqualKeys (HashMap<EqK, K, V> other) Source #

Equality of keys only

method int GetHashCode () Source #

method HashMap<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 HashMap<EqK, K, U> Select <U> (Func<V, U> mapper) Source #

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<EqK, K, U> Select <U> (Func<K, V, U> mapper) Source #

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<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 HashMap<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<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<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 IReadOnlyDictionary<K, V> ToReadOnlyDictionary () Source #

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

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

Operators

operator == (HashMap<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, HashMap<EqK, K, V> rhs) Source #

In-equality of keys and values with EqDefault〈V〉 used for values

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

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

class HashMapExtensions Source #

Methods

method HashMap<Key, V> As <Key, V> (this K<HashMap<Key>, V> ma) Source #

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

Create an immutable hash-map

method HashMap<(K1, K2), V> ToHashMap <K1, K2, V> (this IEnumerable<(K1, K2, V)> items) Source #

Create an immutable hash-map

method HashMap<(K1, K2, K3), V> ToHashMap <K1, K2, K3, V> (this IEnumerable<(K1, K2, K3, V)> items) Source #

Create an immutable hash-map

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

Create an immutable hash-map

method IQueryable<(K Key, V Value)> AsQueryable <K, V> (this HashMap<K, V> source) Source #

Convert to a queryable

class HashMapExtensions Source #

Methods

method HashMap<EqKey, Key, V> As <EqKey, Key, V> (this K<HashMapEq<EqKey, Key>, V> ma) Source #

where EqKey : Eq<Key>

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

where EqK : Eq<K>

Create an immutable hash-map

method HashMap<EqK, (K1, K2), V> ToHashMap <EqK, K1, K2, V> (this IEnumerable<(K1, K2, V)> items) Source #

where EqK : Eq<(K1, K2)>

Create an immutable hash-map

method HashMap<EqK, (K1, K2, K3), V> ToHashMap <EqK, K1, K2, K3, V> (this IEnumerable<(K1, K2, K3, V)> items) Source #

where EqK : Eq<(K1, K2, K3)>

Create an immutable hash-map

method HashMap<EqK, (K1, K2, K3, K4), V> ToHashMap <EqK, K1, K2, K3, K4, V> (this IEnumerable<(K1, K2, K3, K4, V)> items) Source #

where EqK : Eq<(K1, K2, K3, K4)>

Create an immutable hash-map

method IQueryable<(K Key, V Value)> AsQueryable <EqK, K, V> (this HashMap<EqK, K, V> source) Source #

where EqK : Eq<K>

Convert to a queryable

class HashMapExtensions Source #

Methods

method HashMap<Key, B> Map <Key, A, B> (this Func<A, B> f, K<HashMap<Key>, A> ma) Source #

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method HashMap<Key, B> Map <Key, A, B> (this Func<A, B> f, HashMap<Key, A> ma) Source #

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method HashMap<EqKey, Key, B> Map <EqKey, Key, A, B> (this Func<A, B> f, K<HashMapEq<EqKey, Key>, A> ma) Source #

where EqKey : Eq<Key>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method HashMap<EqKey, Key, B> Map <EqKey, Key, A, B> (this Func<A, B> f, HashMap<EqKey, Key, A> ma) Source #

where EqKey : Eq<Key>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

class HashMap Source #

Immutable hash-map module

Methods

method HashMap<K, V> clear <K, V> (HashMap<K, V> map) Source #

Clears all items from the map

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

Parameters

param map

Map to clear

returns

Empty map

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

Creates a new empty HashMap

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

Create a singleton collection

Parameters

param value

Single value

returns

Collection with a single item in it

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

Create a singleton collection

Parameters

param value

Single value

returns

Collection with a single item in it

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

Creates a new empty HashMap

method HashMap<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 HashMap<K, V> create <K, V> ((K, V) head, params (K, V)[] tail) Source #

Creates a new Map seeded with the keyValues provided

method HashMap<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 HashMap<K, V> createRange <K, V> (IEnumerable<Tuple<K, V>> keyValues) Source #

Creates a new Map seeded with the keyValues provided

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

Creates a new Map seeded with the keyValues provided

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

Creates a new Map seeded with the keyValues provided

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

Creates a new Map seeded with the keyValues provided

method HashMap<K, V> add <K, V> (HashMap<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 HashMap<K, V> tryAdd <K, V> (HashMap<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 HashMap<K, V> addOrUpdate <K, V> (HashMap<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 HashMap<K, V> addOrUpdate <K, V> (HashMap<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 HashMap<K, V> addOrUpdate <K, V> (HashMap<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 HashMap<K, V> addRange <K, V> (HashMap<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 HashMap<K, V> addRange <K, V> (HashMap<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 HashMap<K, V> addRange <K, V> (HashMap<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 HashMap<K, V> tryAddRange <K, V> (HashMap<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 HashMap<K, V> tryAddRange <K, V> (HashMap<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 HashMap<K, V> tryAddRange <K, V> (HashMap<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 HashMap<K, V> addOrUpdateRange <K, V> (HashMap<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 HashMap<K, V> addOrUpdateRange <K, V> (HashMap<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 HashMap<K, V> addOrUpdateRange <K, V> (HashMap<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 HashMap<K, V> remove <K, V> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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 HashMap<K, V> setItem <K, V> (HashMap<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 HashMap<K, V> trySetItem <K, V> (HashMap<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 HashMap<K, V> trySetItem <K, V> (HashMap<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 HashMap<K, V> setItems <K, V> (HashMap<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 HashMap<K, V> setItems <K, V> (HashMap<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 HashMap<K, V> setItems <K, V> (HashMap<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 HashMap<K, V> trySetItems <K, V> (HashMap<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 HashMap<K, V> trySetItems <K, V> (HashMap<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 HashMap<K, V> trySetItems <K, V> (HashMap<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 HashMap<K, V> trySetItems <K, V> (HashMap<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> (HashMap<K, V> map, K key) Source #

Retrieve a value from the map by key

Parameters

param key

Key to find

returns

Found value

method R find <K, V, R> (HashMap<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 HashMap<K, V> setItem <K, V> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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 HashMap<K, U> map <K, T, U> (HashMap<K, T> map, Func<T, U> f) Source #

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<K, U> map <K, T, U> (HashMap<K, T> map, Func<K, T, U> f) Source #

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<K, V> filter <K, V> (HashMap<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 HashMap<K, V> filter <K, V> (HashMap<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

class HashMap Source #

Immutable hash-map module

Methods

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

where EqK : Eq<K>

Clears all items from the map

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

Parameters

param map

Map to clear

returns

Empty map

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

where EqK : Eq<K>

Creates a new empty Map

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

where EqK : Eq<K>

Creates a new empty HashMap

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

where EqK : Eq<K>

Create a singleton collection

Parameters

param value

Single value

returns

Collection with a single item in it

method HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<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 HashMap<EqK, K, V> add <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> tryAdd <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> addOrUpdate <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> addOrUpdate <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> addOrUpdate <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> addRange <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> addRange <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> addRange <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> tryAddRange <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> tryAddRange <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> tryAddRange <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> addOrUpdateRange <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> addOrUpdateRange <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> addOrUpdateRange <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> remove <EqK, K, V> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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 HashMap<EqK, K, V> setItem <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> trySetItem <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> trySetItem <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> setItems <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> setItems <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> setItems <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> trySetItems <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> trySetItems <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> trySetItems <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> trySetItems <EqK, K, V> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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 HashMap<EqK, K, V> setItem <EqK, K, V> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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> (HashMap<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 HashMap<EqK, K, U> map <EqK, K, T, U> (HashMap<EqK, K, T> map, Func<T, U> f) Source #

where EqK : Eq<K>

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<EqK, K, U> map <EqK, K, T, U> (HashMap<EqK, K, T> map, Func<K, T, U> f) Source #

where EqK : Eq<K>

Atomically maps the map to a new map

Parameters

returns

Mapped items in a new map

method HashMap<EqK, K, V> filter <EqK, K, V> (HashMap<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 HashMap<EqK, K, V> filter <EqK, K, V> (HashMap<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> (HashMap<EqK, K, T> map) Source #

where EqK : Eq<K>

Number of items in the map

method S fold <EqK, S, K, V> (HashMap<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 bool exists <EqK, K, V> (HashMap<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> (HashMap<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> (HashMap<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

class Prelude Source #

Methods

method HashMap<Key, B> map <Key, A, B> (Func<A, B> f, K<HashMap<Key>, A> ma) Source #

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method HashMap<EqKey, Key, B> map <EqKey, Key, A, B> (this Func<A, B> f, K<HashMapEq<EqKey, Key>, A> ma) Source #

where EqKey : Eq<Key>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

class HashMap <Key> Source #

class HashMapEq <EqKey, Key> Source #

where EqKey : Eq<Key>

Methods

method K<HashMapEq<EqKey, Key>, B> Map <A, B> (Func<A, B> f, K<HashMapEq<EqKey, Key>, A> ma) Source #