Map<OrdK, K, V> Struct

Immutable map AVL tree implementation AVL tree is a self-balancing binary search tree. http://en.wikipedia.org/wiki/AVL_tree

DECLARATION
[Serializable]
public struct Map<OrdK, K, V> : IEnumerable<ValueTuple<K, V>>,
IEquatable<Map<OrdK, K, V>>
NAMESPACE
LanguageExt

Constructors

Map(IEnumerable<ValueTuple<K, V>>)
PARAMETERS
items
IEnumerable<ValueTuple<K, V>>
DECLARATION
public ctor Map(IEnumerable<ValueTuple<K, V>> items)

Fields

Empty
DECLARATION
public static Map<OrdK, K, V> Empty

Properties

Count
SUMMARY

Number of items in the map

DECLARATION
[Pure]
public int Count { get; }
RETURNS
int
IsEmpty
SUMMARY

Is the map empty

DECLARATION
[Pure]
public bool IsEmpty { get; }
RETURNS
bool
Keys
SUMMARY

Enumerable of map keys

DECLARATION
[Pure]
public IEnumerable<K> Keys { get; }
RETURNS
IEnumerable<K>
Length
SUMMARY

Alias of Count

DECLARATION
[Pure]
public int Length { get; }
RETURNS
int
this
SUMMARY

'this' accessor

DECLARATION
[Pure]
public V this [K key] { get; }
RETURNS
V
Optional value
Tuples
SUMMARY

Enumerable of in-order tuples that make up the map

DECLARATION
[Pure]
public IEnumerable<Tuple<K, V>> Tuples { get; }
RETURNS
IEnumerable<Tuple<K, V>>
Tuples
Values
SUMMARY

Enumerable of map values

DECLARATION
[Pure]
public IEnumerable<V> Values { get; }
RETURNS
IEnumerable<V>
ValueTuples
SUMMARY

Enumerable of in-order tuples that make up the map

DECLARATION
[Pure]
public IEnumerable<ValueTuple<K, V>> ValueTuples { get; }
RETURNS
IEnumerable<ValueTuple<K, V>>
Tuples

Methods

Add(K, V)
SUMMARY

Atomically adds a new item to the map

PARAMETERS
key
K
Key
value
V
Value
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> Add(K key, V value)
RETURNS
Map<OrdK, K, V>
New Map with the item added
EXCEPTIONS
ArgumentException
Throws ArgumentException if the key already exists
ArgumentNullException
Throws ArgumentNullException the key or value are null
AddOrUpdate(K, V)
SUMMARY

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

PARAMETERS
key
K
Key
value
V
Value
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> AddOrUpdate(K key, V value)
RETURNS
Map<OrdK, K, V>
New Map with the item added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the key or value are null
AddOrUpdate(K, Func<V, V>, Func<V>)
SUMMARY

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
key
K
Key to find
Some
Func<V, V>
None
Func<V>
DECLARATION
[Pure]
public Map<OrdK, K, V> AddOrUpdate(K key, Func<V, V> Some, Func<V> None)
RETURNS
Map<OrdK, K, V>
New map with the mapped value
EXCEPTIONS
Exception
Throws Exception if None returns null
Exception
Throws Exception if Some returns null
AddOrUpdate(K, Func<V, V>, V)
SUMMARY

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
key
K
Key to find
Some
Func<V, V>
None
V
DECLARATION
[Pure]
public Map<OrdK, K, V> AddOrUpdate(K key, Func<V, V> Some, V None)
RETURNS
Map<OrdK, K, V>
New map with the mapped value
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException if None is null
Exception
Throws Exception if Some returns null
AddOrUpdateRange(IEnumerable<Tuple<K, V>>)
SUMMARY

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

PARAMETERS
range
IEnumerable<Tuple<K, V>>
Range of tuples to add
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> AddOrUpdateRange(IEnumerable<Tuple<K, V>> range)
RETURNS
Map<OrdK, K, V>
New Map with the items added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the keys or values are null
AddOrUpdateRange(IEnumerable<ValueTuple<K, V>>)
SUMMARY

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

PARAMETERS
range
IEnumerable<ValueTuple<K, V>>
Range of tuples to add
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> AddOrUpdateRange(IEnumerable<ValueTuple<K, V>> range)
RETURNS
Map<OrdK, K, V>
New Map with the items added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the keys or values are null
AddOrUpdateRange(IEnumerable<KeyValuePair<K, V>>)
SUMMARY

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

PARAMETERS
range
IEnumerable<KeyValuePair<K, V>>
Range of KeyValuePairs to add
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> AddOrUpdateRange(IEnumerable<KeyValuePair<K, V>> range)
RETURNS
Map<OrdK, K, V>
New Map with the items added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the keys or values are null
AddRange(IEnumerable<Tuple<K, V>>)
SUMMARY

Atomically adds a range of items to the map.

PARAMETERS
range
IEnumerable<Tuple<K, V>>
Range of tuples to add
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> AddRange(IEnumerable<Tuple<K, V>> range)
RETURNS
Map<OrdK, K, V>
New Map with the items added
EXCEPTIONS
ArgumentException
Throws ArgumentException if any of the keys already exist
ArgumentNullException
Throws ArgumentNullException the keys or values are null
AddRange(IEnumerable<ValueTuple<K, V>>)
SUMMARY

Atomically adds a range of items to the map.

PARAMETERS
range
IEnumerable<ValueTuple<K, V>>
Range of tuples to add
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> AddRange(IEnumerable<ValueTuple<K, V>> range)
RETURNS
Map<OrdK, K, V>
New Map with the items added
EXCEPTIONS
ArgumentException
Throws ArgumentException if any of the keys already exist
ArgumentNullException
Throws ArgumentNullException the keys or values are null
AddRange(IEnumerable<KeyValuePair<K, V>>)
SUMMARY

Atomically adds a range of items to the map

PARAMETERS
pairs
IEnumerable<KeyValuePair<K, V>>
Range of KeyValuePairs to add
DECLARATION
[Pure]
public Map<OrdK, K, V> AddRange(IEnumerable<KeyValuePair<K, V>> pairs)
RETURNS
Map<OrdK, K, V>
New Map with the items added
EXCEPTIONS
ArgumentException
Throws ArgumentException if any of the keys already exist
AsEnumerable()
DECLARATION
[Pure]
public IEnumerable<ValueTuple<K, V>> AsEnumerable()
RETURNS
IEnumerable<ValueTuple<K, V>>
Choose<U>(Func<K, V, Option<U>>)
SUMMARY

Equivalent to map and filter but the filtering is done based on whether the returned Option is Some or None. If the item is None then it's filtered out, if not the the mapped Some value is used.

PARAMETERS
selector
Func<K, V, Option<U>>
Predicate
DECLARATION
[Pure]
public Map<OrdK, K, U> Choose<U>(Func<K, V, Option<U>> selector)
RETURNS
Map<OrdK, K, U>
Filtered map
Choose<U>(Func<V, Option<U>>)
SUMMARY

Equivalent to map and filter but the filtering is done based on whether the returned Option is Some or None. If the item is None then it's filtered out, if not the the mapped Some value is used.

PARAMETERS
selector
Func<V, Option<U>>
Predicate
DECLARATION
[Pure]
public Map<OrdK, K, U> Choose<U>(Func<V, Option<U>> selector)
RETURNS
Map<OrdK, K, U>
Filtered map
Clear()
SUMMARY

Clears all items from the map

REMARKS
Functionally equivalent to calling Map.empty as the original structure is untouched
DECLARATION
[Pure]
public Map<OrdK, K, V> Clear()
RETURNS
Map<OrdK, K, V>
Empty map
Contains(K, V)
SUMMARY

Checks for existence of a key in the map

PARAMETERS
key
K
Key to check
value
V
DECLARATION
[Pure]
public bool Contains(K key, V value)
RETURNS
bool
True if an item with the key supplied is in the map
Contains(KeyValuePair<K, V>)
SUMMARY

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

PARAMETERS
pair
KeyValuePair<K, V>
Pair to find
DECLARATION
[Pure]
public bool Contains(KeyValuePair<K, V> pair)
RETURNS
bool
True if exists, false otherwise
ContainsKey(K)
SUMMARY

Checks for existence of a key in the map

PARAMETERS
key
K
Key to check
DECLARATION
[Pure]
public bool ContainsKey(K key)
RETURNS
bool
True if an item with the key supplied is in the map
Equals(Map<OrdK, K, V>)
PARAMETERS
y
Map<OrdK, K, V>
DECLARATION
[Pure]
public bool Equals(Map<OrdK, K, V> y)
RETURNS
bool
Equals(object)
PARAMETERS
obj
object
DECLARATION
[Pure]
public override bool Equals(object obj)
RETURNS
bool
Except(Map<OrdK, K, V>)
SUMMARY

Map differencing based on key. this - other.

PARAMETERS
other
Map<OrdK, K, V>
DECLARATION
[Pure]
public Map<OrdK, K, V> Except(Map<OrdK, K, V> other)
RETURNS
Map<OrdK, K, V>
Exists(Func<K, V, bool>)
SUMMARY

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

PARAMETERS
pred
Func<K, V, bool>
Predicate
DECLARATION
[Pure]
public bool Exists(Func<K, V, bool> pred)
RETURNS
bool
True if all items in the map return true when the predicate is applied
Exists(Func<Tuple<K, V>, bool>)
SUMMARY

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

PARAMETERS
pred
Func<Tuple<K, V>, bool>
Predicate
DECLARATION
[Pure]
public bool Exists(Func<Tuple<K, V>, bool> pred)
RETURNS
bool
True if all items in the map return true when the predicate is applied
Exists(Func<ValueTuple<K, V>, bool>)
SUMMARY

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

PARAMETERS
pred
Func<ValueTuple<K, V>, bool>
Predicate
DECLARATION
[Pure]
public bool Exists(Func<ValueTuple<K, V>, bool> pred)
RETURNS
bool
True if all items in the map return true when the predicate is applied
Exists(Func<KeyValuePair<K, V>, bool>)
SUMMARY

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

PARAMETERS
pred
Func<KeyValuePair<K, V>, bool>
Predicate
DECLARATION
[Pure]
public bool Exists(Func<KeyValuePair<K, V>, bool> pred)
RETURNS
bool
True if all items in the map return true when the predicate is applied
Exists(Func<V, bool>)
SUMMARY

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

PARAMETERS
pred
Func<V, bool>
Predicate
DECLARATION
[Pure]
public bool Exists(Func<V, bool> pred)
RETURNS
bool
True if all items in the map return true when the predicate is applied
Filter(Func<V, bool>)
SUMMARY

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

PARAMETERS
pred
Func<V, bool>
Predicate
DECLARATION
[Pure]
public Map<OrdK, K, V> Filter(Func<V, bool> pred)
RETURNS
Map<OrdK, K, V>
New map with items filtered
Filter(Func<K, V, bool>)
SUMMARY

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

PARAMETERS
pred
Func<K, V, bool>
Predicate
DECLARATION
[Pure]
public Map<OrdK, K, V> Filter(Func<K, V, bool> pred)
RETURNS
Map<OrdK, K, V>
New map with items filtered
Find(K)
SUMMARY

Retrieve a value from the map by key

PARAMETERS
key
K
Key to find
DECLARATION
[Pure]
public Option<V> Find(K key)
RETURNS
Option<V>
Found value
Find<R>(K, Func<V, R>, Func<R>)
SUMMARY

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

PARAMETERS
key
K
Key to find
Some
Func<V, R>
None
Func<R>
DECLARATION
[Pure]
public R Find<R>(K key, Func<V, R> Some, Func<R> None)
RETURNS
R
Found value
FindRange(K, K)
SUMMARY

Retrieve a range of values

PARAMETERS
keyFrom
K
Range start (inclusive)
keyTo
K
Range to (inclusive)
DECLARATION
[Pure]
public IEnumerable<V> FindRange(K keyFrom, K keyTo)
RETURNS
IEnumerable<V>
Range of values
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the keyFrom or keyTo are null
FindSeq(K)
SUMMARY

Retrieve a value from the map by key as an enumerable

PARAMETERS
key
K
Key to find
DECLARATION
[Pure]
public IEnumerable<V> FindSeq(K key)
RETURNS
IEnumerable<V>
Found value
Fold<S>(S, Func<S, K, V, S>)
SUMMARY

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

PARAMETERS
state
S
Initial state
folder
Func<S, K, V, S>
Fold function
DECLARATION
[Pure]
public S Fold<S>(S state, Func<S, K, V, S> folder)
RETURNS
S
Folded state
Fold<S>(S, Func<S, V, S>)
SUMMARY

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

PARAMETERS
state
S
Initial state
folder
Func<S, V, S>
Fold function
DECLARATION
[Pure]
public S Fold<S>(S state, Func<S, V, S> folder)
RETURNS
S
Folded state
ForAll(Func<K, V, bool>)
SUMMARY

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

PARAMETERS
pred
Func<K, V, bool>
Predicate
DECLARATION
[Pure]
public bool ForAll(Func<K, V, bool> pred)
RETURNS
bool
True if all items in the map return true when the predicate is applied
ForAll(Func<Tuple<K, V>, bool>)
SUMMARY

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

PARAMETERS
pred
Func<Tuple<K, V>, bool>
Predicate
DECLARATION
[Pure]
public bool ForAll(Func<Tuple<K, V>, bool> pred)
RETURNS
bool
True if all items in the map return true when the predicate is applied
ForAll(Func<ValueTuple<K, V>, bool>)
SUMMARY

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

PARAMETERS
pred
Func<ValueTuple<K, V>, bool>
Predicate
DECLARATION
[Pure]
public bool ForAll(Func<ValueTuple<K, V>, bool> pred)
RETURNS
bool
True if all items in the map return true when the predicate is applied
ForAll(Func<KeyValuePair<K, V>, bool>)
SUMMARY

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

PARAMETERS
pred
Func<KeyValuePair<K, V>, bool>
Predicate
DECLARATION
[Pure]
public bool ForAll(Func<KeyValuePair<K, V>, bool> pred)
RETURNS
bool
True if all items in the map return true when the predicate is applied
ForAll(Func<V, bool>)
SUMMARY

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

PARAMETERS
pred
Func<V, bool>
Predicate
DECLARATION
[Pure]
public bool ForAll(Func<V, bool> pred)
RETURNS
bool
True if all items in the map return true when the predicate is applied
GetEnumerator()
SUMMARY

GetEnumerator - IEnumerable interface

DECLARATION
[Pure]
public IEnumerator<ValueTuple<K, V>> GetEnumerator()
RETURNS
IEnumerator<ValueTuple<K, V>>
GetHashCode()
DECLARATION
[Pure]
public override int GetHashCode()
RETURNS
int
Intersect<V2, R>(Map<OrdK, K, V2>, WhenMatched<K, V, V2, R>)
SUMMARY

PARAMETERS
other
Map<OrdK, K, V2>
Merge
WhenMatched<K, V, V2, R>
DECLARATION
[Pure]
public Map<OrdK, K, R> Intersect<V2, R>(Map<OrdK, K, V2> other, WhenMatched<K, V, V2, R> Merge)
RETURNS
Map<OrdK, K, R>
Iter(Action<K, V>)
SUMMARY

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

PARAMETERS
action
Action<K, V>
Action to execute
DECLARATION
public Unit Iter(Action<K, V> action)
Iter(Action<V>)
SUMMARY

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

PARAMETERS
action
Action<V>
Action to execute
DECLARATION
public Unit Iter(Action<V> action)
Iter(Action<Tuple<K, V>>)
SUMMARY

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

PARAMETERS
action
Action<Tuple<K, V>>
Action to execute
DECLARATION
public Unit Iter(Action<Tuple<K, V>> action)
Iter(Action<ValueTuple<K, V>>)
SUMMARY

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

PARAMETERS
action
Action<ValueTuple<K, V>>
Action to execute
DECLARATION
public Unit Iter(Action<ValueTuple<K, V>> action)
Iter(Action<KeyValuePair<K, V>>)
SUMMARY

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

PARAMETERS
action
Action<KeyValuePair<K, V>>
Action to execute
DECLARATION
public Unit Iter(Action<KeyValuePair<K, V>> action)
Remove(K)
SUMMARY

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

PARAMETERS
key
K
Key
DECLARATION
[Pure]
public Map<OrdK, K, V> Remove(K key)
RETURNS
Map<OrdK, K, V>
New map with the item removed
RemoveRange(IEnumerable<K>)
SUMMARY

Atomically removes a set of keys from the map

PARAMETERS
keys
IEnumerable<K>
Keys to remove
DECLARATION
[Pure]
public Map<OrdK, K, V> RemoveRange(IEnumerable<K> keys)
RETURNS
Map<OrdK, K, V>
New map with the items removed
Select<U>(Func<V, U>)
SUMMARY

Atomically maps the map to a new map

PARAMETERS
mapper
Func<V, U>
DECLARATION
[Pure]
[EditorBrowsable(EditorBrowsableState.Never)]
public Map<OrdK, K, U> Select<U>(Func<V, U> mapper)
RETURNS
Map<OrdK, K, U>
Mapped items in a new map
Select<U>(Func<K, V, U>)
SUMMARY

Atomically maps the map to a new map

PARAMETERS
mapper
Func<K, V, U>
DECLARATION
[Pure]
[EditorBrowsable(EditorBrowsableState.Never)]
public Map<OrdK, K, U> Select<U>(Func<K, V, U> mapper)
RETURNS
Map<OrdK, K, U>
Mapped items in a new map
SetItem(K, V)
SUMMARY

Atomically updates an existing item

PARAMETERS
key
K
Key
value
V
Value
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> SetItem(K key, V value)
RETURNS
Map<OrdK, K, V>
New Map with the item added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the key or value are null
SetItem(K, Func<V, V>)
SUMMARY

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

PARAMETERS
key
K
Key to set
Some
Func<V, V>
DECLARATION
[Pure]
public Map<OrdK, K, V> SetItem(K key, Func<V, V> Some)
RETURNS
Map<OrdK, K, V>
New map with the mapped value
EXCEPTIONS
ArgumentException
Throws ArgumentException if the item isn't found
Exception
Throws Exception if Some returns null
SetItems(IEnumerable<KeyValuePair<K, V>>)
SUMMARY

Atomically sets a series of items using the KeyValuePairs provided

PARAMETERS
items
IEnumerable<KeyValuePair<K, V>>
Items to set
DECLARATION
[Pure]
public Map<OrdK, K, V> SetItems(IEnumerable<KeyValuePair<K, V>> items)
RETURNS
Map<OrdK, K, V>
New map with the items set
EXCEPTIONS
ArgumentException
Throws ArgumentException if any of the keys aren't in the map
SetItems(IEnumerable<Tuple<K, V>>)
SUMMARY

Atomically sets a series of items using the Tuples provided.

PARAMETERS
items
IEnumerable<Tuple<K, V>>
Items to set
DECLARATION
[Pure]
public Map<OrdK, K, V> SetItems(IEnumerable<Tuple<K, V>> items)
RETURNS
Map<OrdK, K, V>
New map with the items set
EXCEPTIONS
ArgumentException
Throws ArgumentException if any of the keys aren't in the map
SetItems(IEnumerable<ValueTuple<K, V>>)
SUMMARY

Atomically sets a series of items using the Tuples provided.

PARAMETERS
items
IEnumerable<ValueTuple<K, V>>
Items to set
DECLARATION
[Pure]
public Map<OrdK, K, V> SetItems(IEnumerable<ValueTuple<K, V>> items)
RETURNS
Map<OrdK, K, V>
New map with the items set
EXCEPTIONS
ArgumentException
Throws ArgumentException if any of the keys aren't in the map
Skip(int)
SUMMARY

Skips 'amount' values and returns a new tree without the skipped values.

PARAMETERS
amount
int
Amount to skip
DECLARATION
[Pure]
public IEnumerable<ValueTuple<K, V>> Skip(int amount)
RETURNS
IEnumerable<ValueTuple<K, V>>
New tree
SymmetricExcept(Map<OrdK, K, V>)
SUMMARY

Keys that are in both maps are dropped and the remaining items are merged and returned.

PARAMETERS
other
Map<OrdK, K, V>
DECLARATION
[Pure]
public Map<OrdK, K, V> SymmetricExcept(Map<OrdK, K, V> other)
RETURNS
Map<OrdK, K, V>
ToDictionary()
SUMMARY

Convert the map to an IReadOnlyDictionary<K, V>

DECLARATION
[Pure]
public IReadOnlyDictionary<K, V> ToDictionary()
RETURNS
IReadOnlyDictionary<K, V>
ToDictionary<KR, VR>(Func<ValueTuple<K, V>, KR>, Func<ValueTuple<K, V>, VR>)
SUMMARY

Map the map the a dictionary

PARAMETERS
keySelector
Func<ValueTuple<K, V>, KR>
valueSelector
Func<ValueTuple<K, V>, VR>
DECLARATION
[Pure]
public IDictionary<KR, VR> ToDictionary<KR, VR>(Func<ValueTuple<K, V>, KR> keySelector, Func<ValueTuple<K, V>, VR> valueSelector)
RETURNS
IDictionary<KR, VR>
ToReadOnlyDictionary()
SUMMARY

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

DECLARATION
[Pure]
public IReadOnlyDictionary<K, V> ToReadOnlyDictionary()
RETURNS
IReadOnlyDictionary<K, V>
ToSeq()
DECLARATION
[Pure]
public Seq<ValueTuple<K, V>> ToSeq()
RETURNS
Seq<ValueTuple<K, V>>
TryAdd(K, V)
SUMMARY

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

PARAMETERS
key
K
Key
value
V
Value
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> TryAdd(K key, V value)
RETURNS
Map<OrdK, K, V>
New Map with the item added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the key or value are null
TryAdd(K, V, Func<Map<OrdK, K, V>, V, Map<OrdK, K, V>>)
SUMMARY

Atomically adds a new item to the map. If the key already exists then the Fail handler is called with the unaltered map and the value already set for the key, it expects a new map returned.

PARAMETERS
key
K
Key
value
V
Value
Fail
Func<Map<OrdK, K, V>, V, Map<OrdK, K, V>>
Delegate to handle failure, you're given the unaltered map and the value already set for the key
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> TryAdd(K key, V value, Func<Map<OrdK, K, V>, V, Map<OrdK, K, V>> Fail)
RETURNS
Map<OrdK, K, V>
New Map with the item added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the key or value are null
TryAddRange(IEnumerable<Tuple<K, V>>)
SUMMARY

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

PARAMETERS
range
IEnumerable<Tuple<K, V>>
Range of tuples to add
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> TryAddRange(IEnumerable<Tuple<K, V>> range)
RETURNS
Map<OrdK, K, V>
New Map with the items added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the keys or values are null
TryAddRange(IEnumerable<ValueTuple<K, V>>)
SUMMARY

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

PARAMETERS
range
IEnumerable<ValueTuple<K, V>>
Range of tuples to add
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> TryAddRange(IEnumerable<ValueTuple<K, V>> range)
RETURNS
Map<OrdK, K, V>
New Map with the items added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the keys or values are null
TryAddRange(IEnumerable<KeyValuePair<K, V>>)
SUMMARY

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

PARAMETERS
range
IEnumerable<KeyValuePair<K, V>>
Range of KeyValuePairs to add
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> TryAddRange(IEnumerable<KeyValuePair<K, V>> range)
RETURNS
Map<OrdK, K, V>
New Map with the items added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the keys or values are null
TrySetItem(K, V)
SUMMARY

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

PARAMETERS
key
K
Key
value
V
Value
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> TrySetItem(K key, V value)
RETURNS
Map<OrdK, K, V>
New Map with the item added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException the value is null
TrySetItem(K, Func<V, V>)
SUMMARY

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
key
K
Key to set
Some
Func<V, V>
delegate to map the existing value to a new one before setting
DECLARATION
[Pure]
public Map<OrdK, K, V> TrySetItem(K key, Func<V, V> Some)
RETURNS
Map<OrdK, K, V>
New map with the item set
EXCEPTIONS
Exception
Throws Exception if Some returns null
ArgumentNullException
Throws ArgumentNullException the key or value are null
TrySetItem(K, Func<V, V>, Func<Map<K, V>, Map<K, V>>)
SUMMARY

Atomically sets an item by first retrieving it, applying a map, and then putting it back. Calls the None delegate to return a new map if the item can't be found

PARAMETERS
key
K
Key
Some
Func<V, V>
delegate to map the existing value to a new one before setting
None
Func<Map<K, V>, Map<K, V>>
delegate to return a new map if the item can't be found
REMARKS
Null is not allowed for a Key or a Value
DECLARATION
[Pure]
public Map<OrdK, K, V> TrySetItem(K key, Func<V, V> Some, Func<Map<K, V>, Map<K, V>> None)
RETURNS
Map<OrdK, K, V>
New map with the item set
EXCEPTIONS
Exception
Throws Exception if Some returns null
Exception
Throws Exception if None returns null
TrySetItems(IEnumerable<KeyValuePair<K, V>>)
SUMMARY

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

PARAMETERS
items
IEnumerable<KeyValuePair<K, V>>
Items to set
DECLARATION
[Pure]
public Map<OrdK, K, V> TrySetItems(IEnumerable<KeyValuePair<K, V>> items)
RETURNS
Map<OrdK, K, V>
New map with the items set
TrySetItems(IEnumerable<Tuple<K, V>>)
SUMMARY

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

PARAMETERS
items
IEnumerable<Tuple<K, V>>
Items to set
DECLARATION
[Pure]
public Map<OrdK, K, V> TrySetItems(IEnumerable<Tuple<K, V>> items)
RETURNS
Map<OrdK, K, V>
New map with the items set
TrySetItems(IEnumerable<ValueTuple<K, V>>)
SUMMARY

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

PARAMETERS
items
IEnumerable<ValueTuple<K, V>>
Items to set
DECLARATION
[Pure]
public Map<OrdK, K, V> TrySetItems(IEnumerable<ValueTuple<K, V>> items)
RETURNS
Map<OrdK, K, V>
New map with the items set
TrySetItems(IEnumerable<K>, Func<V, V>)
SUMMARY

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
keys
IEnumerable<K>
Keys of items to set
Some
Func<V, V>
Function map the existing item to a new one
DECLARATION
[Pure]
public Map<OrdK, K, V> TrySetItems(IEnumerable<K> keys, Func<V, V> Some)
RETURNS
Map<OrdK, K, V>
New map with the items set
Union(Map<OrdK, K, V>, WhenMatched<K, V, V, V>)
SUMMARY

Union two maps. The merge function is called keys are present in both map.

PARAMETERS
other
Map<OrdK, K, V>
Merge
WhenMatched<K, V, V, V>
DECLARATION
[Pure]
public Map<OrdK, K, V> Union(Map<OrdK, K, V> other, WhenMatched<K, V, V, V> Merge)
RETURNS
Map<OrdK, K, V>
Union<V2, R>(Map<OrdK, K, V2>, WhenMissing<K, V, R>, WhenMissing<K, V2, R>, WhenMatched<K, V, V2, R>)
SUMMARY

Union two maps. The merge function is called keys are present in both map.

PARAMETERS
other
Map<OrdK, K, V2>
MapLeft
WhenMissing<K, V, R>
MapRight
WhenMissing<K, V2, R>
Merge
WhenMatched<K, V, V2, R>
DECLARATION
[Pure]
public Map<OrdK, K, R> Union<V2, R>(Map<OrdK, K, V2> other, WhenMissing<K, V, R> MapLeft, WhenMissing<K, V2, R> MapRight, WhenMatched<K, V, V2, R> Merge)
RETURNS
Map<OrdK, K, R>
Union<V2>(Map<OrdK, K, V2>, WhenMissing<K, V2, V>, WhenMatched<K, V, V2, V>)
SUMMARY

Union two maps. The merge function is called keys are present in both map.

PARAMETERS
other
Map<OrdK, K, V2>
MapRight
WhenMissing<K, V2, V>
Merge
WhenMatched<K, V, V2, V>
DECLARATION
[Pure]
public Map<OrdK, K, V> Union<V2>(Map<OrdK, K, V2> other, WhenMissing<K, V2, V> MapRight, WhenMatched<K, V, V2, V> Merge)
RETURNS
Map<OrdK, K, V>
Union<V2>(Map<OrdK, K, V2>, WhenMissing<K, V, V2>, WhenMatched<K, V, V2, V2>)
SUMMARY

Union two maps. The merge function is called keys are present in both map.

PARAMETERS
other
Map<OrdK, K, V2>
MapLeft
WhenMissing<K, V, V2>
Merge
WhenMatched<K, V, V2, V2>
DECLARATION
[Pure]
public Map<OrdK, K, V2> Union<V2>(Map<OrdK, K, V2> other, WhenMissing<K, V, V2> MapLeft, WhenMatched<K, V, V2, V2> Merge)
RETURNS
Map<OrdK, K, V2>
Where(Func<V, bool>)
SUMMARY

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

PARAMETERS
pred
Func<V, bool>
Predicate
DECLARATION
[Pure]
[EditorBrowsable(EditorBrowsableState.Never)]
public Map<OrdK, K, V> Where(Func<V, bool> pred)
RETURNS
Map<OrdK, K, V>
New map with items filtered
Where(Func<K, V, bool>)
SUMMARY

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

PARAMETERS
pred
Func<K, V, bool>
Predicate
DECLARATION
[Pure]
[EditorBrowsable(EditorBrowsableState.Never)]
public Map<OrdK, K, V> Where(Func<K, V, bool> pred)
RETURNS
Map<OrdK, K, V>
New map with items filtered