HashSet<EqA, A> Struct

Unsorted immutable hash-set

DECLARATION
public struct HashSet<EqA, A> : IEnumerable<A>,
IEquatable<HashSet<EqA, A>>
NAMESPACE
LanguageExt

Fields

Empty
DECLARATION
public static readonly HashSet<EqA, A> Empty

Properties

Count
SUMMARY

Number of items in the set

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

Is the map empty

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

Number of items in the set

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

'this' accessor

DECLARATION
[Pure]
public A this [A key] { get; }
RETURNS
A
Optional value

Methods

Add(A)
SUMMARY

Add an item to the set

PARAMETERS
key
A
DECLARATION
[Pure]
public HashSet<EqA, A> Add(A key)
RETURNS
HashSet<EqA, A>
New set with the item added
AddOrUpdate(A)
SUMMARY

Add an item to the set. If an item already exists then replace it.

PARAMETERS
key
A
DECLARATION
[Pure]
public HashSet<EqA, A> AddOrUpdate(A key)
RETURNS
HashSet<EqA, A>
New set with the item maybe added
AddOrUpdateRange(IEnumerable<A>)
SUMMARY

Atomically adds a range of items to the set. If any items already exist, they're ignored.

PARAMETERS
range
IEnumerable<A>
Range of keys to add
REMARKS
Null is not allowed for a Key
DECLARATION
[Pure]
public HashSet<EqA, A> AddOrUpdateRange(IEnumerable<A> range)
RETURNS
HashSet<EqA, A>
New HSet with the items added
EXCEPTIONS
ArgumentException
Throws ArgumentException if any of the keys already exist
ArgumentNullException
Throws ArgumentNullException if any of the keys are null
AddRange(IEnumerable<A>)
SUMMARY

Atomically adds a range of items to the set.

PARAMETERS
range
IEnumerable<A>
Range of keys to add
REMARKS
Null is not allowed for a Key
DECLARATION
[Pure]
public HashSet<EqA, A> AddRange(IEnumerable<A> range)
RETURNS
HashSet<EqA, A>
New HSet with the items added
EXCEPTIONS
ArgumentException
Throws ArgumentException if any of the keys already exist
ArgumentNullException
Throws ArgumentNullException if any of the keys are null
Append(HashSet<EqA, A>)
PARAMETERS
rhs
HashSet<EqA, A>
DECLARATION
[Pure]
public HashSet<EqA, A> Append(HashSet<EqA, A> rhs)
RETURNS
HashSet<EqA, A>
AsEnumerable()
DECLARATION
[Pure]
public IEnumerable<A> AsEnumerable()
RETURNS
IEnumerable<A>
Bind(Func<A, HashSet<EqA, A>>)
PARAMETERS
f
Func<A, HashSet<EqA, A>>
DECLARATION
[Pure]
public HashSet<EqA, A> Bind(Func<A, HashSet<EqA, A>> f)
RETURNS
HashSet<EqA, A>
Bind<EqB, B>(Func<A, HashSet<EqB, B>>)
PARAMETERS
f
Func<A, HashSet<EqB, B>>
DECLARATION
[Pure]
public HashSet<EqB, B> Bind<EqB, B>(Func<A, HashSet<EqB, B>> f)
RETURNS
HashSet<EqB, B>
CONSTRAINTS
where EqB : struct Eq<B>
Clear()
SUMMARY

Clears all items from the set

REMARKS
Functionally equivalent to calling HSet.empty as the original structure is untouched
DECLARATION
[Pure]
public HashSet<EqA, A> Clear()
RETURNS
HashSet<EqA, A>
Empty HSet
Contains(A)
SUMMARY

Checks for existence of a key in the set

PARAMETERS
key
A
Key to check
DECLARATION
[Pure]
public bool Contains(A key)
RETURNS
bool
True if an item with the key supplied is in the set
CopyTo(A, int)
SUMMARY

Copy the items from the set into the specified array

PARAMETERS
array
A
Array to copy to
index
int
Index into the array to start
DECLARATION
public void CopyTo(A array, int index)
CopyTo(System.Array, int)
SUMMARY

Copy the items from the set into the specified array

PARAMETERS
array
System.Array
Array to copy to
index
int
Index into the array to start
DECLARATION
public void CopyTo(System.Array array, int index)
Equals(HashSet<EqA, A>)
PARAMETERS
other
HashSet<EqA, A>
DECLARATION
[Pure]
public bool Equals(HashSet<EqA, A> other)
RETURNS
bool
Equals(object)
PARAMETERS
obj
object
DECLARATION
[Pure]
public override bool Equals(object obj)
RETURNS
bool
Except(HashSet<EqA, A>)
SUMMARY

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

PARAMETERS
other
HashSet<EqA, A>
DECLARATION
[Pure]
public HashSet<EqA, A> Except(HashSet<EqA, A> other)
RETURNS
HashSet<EqA, A>
Filter(Func<A, bool>)
SUMMARY

Filters items from the set using the predicate. If the predicate returns True for any item then it remains in the set, otherwise it's dropped.

PARAMETERS
pred
Func<A, bool>
Predicate
DECLARATION
[Pure]
public HashSet<EqA, A> Filter(Func<A, bool> pred)
RETURNS
HashSet<EqA, A>
Filtered enumerable
Find(A)
SUMMARY

Retrieve a value from the set by key

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

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

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

Retrieve a value from the set by key as an enumerable

PARAMETERS
key
A
Key to find
DECLARATION
[Pure]
public IEnumerable<A> FindSeq(A key)
RETURNS
IEnumerable<A>
Found value
GetEnumerator()
SUMMARY

GetEnumerator - IEnumerable interface

DECLARATION
[Pure]
public IEnumerator<A> GetEnumerator()
RETURNS
IEnumerator<A>
GetHashCode()
DECLARATION
[Pure]
public override int GetHashCode()
RETURNS
int
Intersect(HashSet<EqA, A>)
SUMMARY

Returns the elements that are in both this and other

PARAMETERS
other
HashSet<EqA, A>
DECLARATION
[Pure]
public HashSet<EqA, A> Intersect(HashSet<EqA, A> other)
RETURNS
HashSet<EqA, A>
IsProperSubsetOf(HashSet<EqA, A>)
SUMMARY

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

PARAMETERS
other
HashSet<EqA, A>
DECLARATION
[Pure]
public bool IsProperSubsetOf(HashSet<EqA, A> other)
RETURNS
bool
True if 'other' is a proper subset of this set
IsProperSupersetOf(HashSet<EqA, A>)
SUMMARY

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

PARAMETERS
other
HashSet<EqA, A>
DECLARATION
[Pure]
public bool IsProperSupersetOf(HashSet<EqA, A> other)
RETURNS
bool
True if 'other' is a proper superset of this set
IsSubsetOf(HashSet<EqA, A>)
SUMMARY

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

PARAMETERS
other
HashSet<EqA, A>
DECLARATION
[Pure]
public bool IsSubsetOf(HashSet<EqA, A> other)
RETURNS
bool
True if 'other' is a superset of this set
IsSupersetOf(HashSet<EqA, A>)
SUMMARY

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

PARAMETERS
other
HashSet<EqA, A>
DECLARATION
[Pure]
public bool IsSupersetOf(HashSet<EqA, A> other)
RETURNS
bool
True if 'other' is a superset of this set
Map(Func<A, A>)
SUMMARY

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

PARAMETERS
mapper
Func<A, A>
Mapping function
DECLARATION
[Pure]
public HashSet<EqA, A> Map(Func<A, A> mapper)
RETURNS
HashSet<EqA, A>
Mapped enumerable
Map<EqB, B>(Func<A, B>)
SUMMARY

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

PARAMETERS
mapper
Func<A, B>
Mapping function
DECLARATION
[Pure]
public HashSet<EqB, B> Map<EqB, B>(Func<A, B> mapper)
RETURNS
HashSet<EqB, B>
Mapped enumerable
CONSTRAINTS
where EqB : struct Eq<B>
Overlaps(HashSet<EqA, A>)
SUMMARY

Returns True if other overlaps this set

PARAMETERS
other
HashSet<EqA, A>
DECLARATION
[Pure]
public bool Overlaps(HashSet<EqA, A> other)
RETURNS
bool
True if other overlaps this set
Remove(A)
SUMMARY

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

PARAMETERS
key
A
Key
DECLARATION
[Pure]
public HashSet<EqA, A> Remove(A key)
RETURNS
HashSet<EqA, A>
New map with the item removed
RemoveRange(IEnumerable<A>)
SUMMARY

Atomically removes a list of keys from the set

PARAMETERS
keys
IEnumerable<A>
Keys to remove
DECLARATION
[Pure]
public HashSet<EqA, A> RemoveRange(IEnumerable<A> keys)
RETURNS
HashSet<EqA, A>
New HSet with the items removed
Select(Func<A, A>)
SUMMARY

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

PARAMETERS
mapper
Func<A, A>
Mapping function
DECLARATION
[Pure]
public HashSet<EqA, A> Select(Func<A, A> mapper)
RETURNS
HashSet<EqA, A>
Mapped enumerable
Select<EqB, B>(Func<A, B>)
SUMMARY

Maps the values of this set into a new set of values using the mapper function to tranform the source values.

PARAMETERS
mapper
Func<A, B>
Mapping function
DECLARATION
[Pure]
public HashSet<EqB, B> Select<EqB, B>(Func<A, B> mapper)
RETURNS
HashSet<EqB, B>
Mapped enumerable
CONSTRAINTS
where EqB : struct Eq<B>
SetEquals(HashSet<EqA, A>)
PARAMETERS
other
HashSet<EqA, A>
DECLARATION
public bool SetEquals(HashSet<EqA, A> other)
RETURNS
bool
SetItem(A)
SUMMARY

Atomically updates an existing item

PARAMETERS
key
A
Key
REMARKS
Null is not allowed for a key
DECLARATION
[Pure]
public HashSet<EqA, A> SetItem(A key)
RETURNS
HashSet<EqA, A>
New HSet with the item added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException if the key is null
SetItems(IEnumerable<A>)
SUMMARY

Atomically sets a series of items

PARAMETERS
items
IEnumerable<A>
Items to set
DECLARATION
[Pure]
public HashSet<EqA, A> SetItems(IEnumerable<A> items)
RETURNS
HashSet<EqA, A>
New HSet with the items set
EXCEPTIONS
ArgumentException
Throws ArgumentException if any of the keys aren't in the map
Subtract(HashSet<EqA, A>)
PARAMETERS
rhs
HashSet<EqA, A>
DECLARATION
[Pure]
public HashSet<EqA, A> Subtract(HashSet<EqA, A> rhs)
RETURNS
HashSet<EqA, A>
SymmetricExcept(HashSet<EqA, A>)
SUMMARY

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

PARAMETERS
other
HashSet<EqA, A>
DECLARATION
[Pure]
public HashSet<EqA, A> SymmetricExcept(HashSet<EqA, A> other)
RETURNS
HashSet<EqA, A>
ToSeq()
DECLARATION
[Pure]
public Seq<A> ToSeq()
RETURNS
Seq<A>
TryAdd(A)
SUMMARY

Attempt to add an item to the set. If an item already exists then return the Set as-is.

PARAMETERS
key
A
DECLARATION
[Pure]
public HashSet<EqA, A> TryAdd(A key)
RETURNS
HashSet<EqA, A>
New set with the item maybe added
TryAddRange(IEnumerable<A>)
SUMMARY

Atomically adds a range of items to the set. If an item already exists, it's ignored.

PARAMETERS
range
IEnumerable<A>
Range of keys to add
REMARKS
Null is not allowed for a Key
DECLARATION
[Pure]
public HashSet<EqA, A> TryAddRange(IEnumerable<A> range)
RETURNS
HashSet<EqA, A>
New HSet with the items added
EXCEPTIONS
ArgumentException
Throws ArgumentException if any of the keys already exist
ArgumentNullException
Throws ArgumentNullException if any of the keys are null
TrySetItem(A)
SUMMARY

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

PARAMETERS
key
A
Key
REMARKS
Null is not allowed for a key
DECLARATION
[Pure]
public HashSet<EqA, A> TrySetItem(A key)
RETURNS
HashSet<EqA, A>
New HSet with the item added
EXCEPTIONS
ArgumentNullException
Throws ArgumentNullException if the key is null
TrySetItems(IEnumerable<A>)
SUMMARY

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

PARAMETERS
items
IEnumerable<A>
Items to set
DECLARATION
[Pure]
public HashSet<EqA, A> TrySetItems(IEnumerable<A> items)
RETURNS
HashSet<EqA, A>
New HSet with the items set
Union(HashSet<EqA, A>)
SUMMARY

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

PARAMETERS
other
HashSet<EqA, A>
Other set to union with
DECLARATION
[Pure]
public HashSet<EqA, A> Union(HashSet<EqA, A> other)
RETURNS
HashSet<EqA, A>
A set which contains all items from both sets
Where(Func<A, bool>)
SUMMARY

Filters items from the set using the predicate. If the predicate returns True for any item then it remains in the set, otherwise it's dropped.

PARAMETERS
pred
Func<A, bool>
Predicate
DECLARATION
[Pure]
public HashSet<EqA, A> Where(Func<A, bool> pred)
RETURNS
HashSet<EqA, A>
Filtered enumerable