Enhanced C#
Language of your choice: library documentation
|
An immutable set. More...
An immutable set.
This is the immutable version of MSet{T}. It does not allow changes to the set, but it provides operators (&, |, ^, -) for intersecting, merging, and subtracting sets, and it can be converted to a mutable MSet{T} in O(1) time. You can also add single items to the set using operators + and -.
For more information, please read the documentation of Set{T} and Impl.InternalSet{T}.
Performance warning: GetHashCode() XORs the hashcodes of all items in the set, while Equals() is a synonym for SetEquals(). Be aware that these methods are very slow for large sets.
Nested classes | |
struct | Enumerator |
Enumerator for MSet{T}. More... | |
Public fields | |
IEqualityComparer< T > | _comparer |
int | _count |
Public static fields | |
static readonly Set< T > | Empty = new Set<T>() |
Properties | |
bool | IsEmpty [get] |
InternalSet< T > | InternalSet [get] |
IEqualityComparer< T > | Comparer [get] |
int | Count [get] |
bool | IsReadOnly [get] |
bool ISetImm< T, Set< T > >. | IsInverted [get] |
Properties inherited from Loyc.Collections.ISetImm< T, SetT > | |
bool | IsInverted [get] |
Returns true if the set is inverted, which means that the enumerator returns all the items that are not in the set, and the IReadOnlyCollection{T}.Count returns the number of items that are not in the set. More... | |
Public Member Functions | |
Set (IEnumerable< T > list) | |
Set (IEqualityComparer< T > comparer) | |
Set (IEnumerable< T > list, IEqualityComparer< T > comparer) | |
Set (InternalSet< T > set, IEqualityComparer< T > comparer) | |
bool IEquatable< Set< T > >. | Equals (Set< T > rhs) |
override bool | Equals (object obj) |
override int | GetHashCode () |
bool | Find (ref T item) |
bool | Contains (T item) |
void | CopyTo (T[] array, int arrayIndex) |
Enumerator | GetEnumerator () |
void ICollection< T >. | Add (T item) |
void ICollection< T >. | Clear () |
bool ICollection< T >. | Remove (T item) |
IEnumerator< T > IEnumerable< T >. | GetEnumerator () |
System.Collections.IEnumerator System.Collections.IEnumerable. | GetEnumerator () |
bool | IsSubsetOf (IEnumerable< T > other) |
Returns true if all items in this set are present in the other set. More... | |
bool | IsSubsetOf (Set< T > other) |
bool | IsSubsetOf (MSet< T > other) |
bool | IsSubsetOf (ISet< T > other) |
bool | IsSupersetOf (IEnumerable< T > other) |
Returns true if all items in the other set are present in this set. More... | |
bool | IsSupersetOf (Set< T > other) |
bool | IsSupersetOf (MSet< T > other) |
bool | Overlaps (IEnumerable< T > other) |
Returns true if this set contains at least one item from 'other'. More... | |
bool | Overlaps (Set< T > other) |
bool | Overlaps (MSet< T > other) |
bool | IsProperSubsetOf (Set< T > other) |
bool | IsProperSubsetOf (MSet< T > other) |
bool | IsProperSubsetOf (ISet< T > other) |
bool | IsProperSubsetOf (IEnumerable< T > other) |
bool | IsProperSupersetOf (Set< T > other) |
bool | IsProperSupersetOf (MSet< T > other) |
bool | IsProperSupersetOf (ISet< T > other) |
bool | IsProperSupersetOf (IEnumerable< T > other) |
bool | SetEquals (Set< T > other) |
bool | SetEquals (MSet< T > other) |
bool | SetEquals (ISet< T > other) |
bool | SetEquals (IEnumerable< T > other) |
ISetImm< T > ISetOperations< T, IEnumerable< T >, ISetImm< T > >. | With (T item) |
ISetImm< T > ISetOperations< T, IEnumerable< T >, ISetImm< T > >. | Without (T item) |
ISetImm< T > ISetOperations< T, IEnumerable< T >, ISetImm< T > >. | Union (IEnumerable< T > other) |
ISetImm< T > ISetOperations< T, IEnumerable< T >, ISetImm< T > >. | Intersect (IEnumerable< T > other) |
ISetImm< T > ISetOperations< T, IEnumerable< T >, ISetImm< T > >. | Except (IEnumerable< T > other) |
ISetImm< T > ISetOperations< T, IEnumerable< T >, ISetImm< T > >. | Xor (IEnumerable< T > other) |
Set< T > | With (T item) |
Set< T > | Without (T item) |
Set< T > | WithToggled (T item) |
Set< T > | Union (Set< T > other) |
Set< T > | Union (Set< T > other, bool replaceWithValuesFromOther) |
Set< T > | Union (MSet< T > other, bool replaceWithValuesFromOther=false) |
Set< T > | Union (IEnumerable< T > other, bool replaceWithValuesFromOther=false) |
Set< T > | Intersect (Set< T > other) |
Set< T > | Intersect (MSet< T > other) |
Set< T > | Intersect (IEnumerable< T > other) |
Set< T > | Except (Set< T > other) |
Set< T > | Except (MSet< T > other) |
Set< T > | Except (IEnumerable< T > other) |
Set< T > | Xor (Set< T > other) |
Set< T > | Xor (MSet< T > other) |
Set< T > | Xor (IEnumerable< T > other) |
MSet< T > | AsMutable () |
Set< T > | Where (Predicate< T > match) |
Returns a new set that contains only items that match the specified predicate (i.e. for which the predicate returns true). More... | |
long | CountMemory (int sizeOfT) |
Measures the total size of all objects allocated to this collection, in bytes, including the size of this object itself; see Impl.InternalSet{T}.CountMemory. More... | |
Public Member Functions inherited from Loyc.Collections.ISetOperations< in T, in InSetT, out OutSetT > | |
OutSetT | Union (InSetT other) |
OutSetT | Intersect (InSetT other) |
OutSetT | Except (InSetT other) |
OutSetT | Xor (InSetT other) |
|
inline |
Measures the total size of all objects allocated to this collection, in bytes, including the size of this object itself; see Impl.InternalSet{T}.CountMemory.
|
inline |
Returns true if all items in this set are present in the other set.
|
inline |
Returns true if all items in the other set are present in this set.
|
inline |
Returns true if this set contains at least one item from 'other'.
|
inline |
Returns a new set that contains only items that match the specified predicate (i.e. for which the predicate returns true).