Class EnumerableComparer
An element-wise equality comparer for sequences of values.
Inheritance
Inherited Members
Namespace: Flame.Collections
Assembly: Flame.dll
Syntax
public static class EnumerableComparer
Fields
| Improve this Doc View SourceEmptyHash
The hash code for an empty sequence.
Declaration
public const int EmptyHash = -2128831035
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceFoldIntoHashCode(Int32, Int32)
Folds a hash code for an element into a hash code for a sequence.
Declaration
public static int FoldIntoHashCode(int hashCode, int elementHashCode)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | hashCode | A hash code for a sequence without the element. |
System.Int32 | elementHashCode | A hash code for an element. |
Returns
Type | Description |
---|---|
System.Int32 | A hash code for a sequence that includes the element. |
FoldIntoHashCode<T>(Int32, T)
Folds a hash code for an element into a hash code for a sequence.
Declaration
public static int FoldIntoHashCode<T>(int hashCode, T element)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | hashCode | A hash code for a sequence without the element. |
T | element | An element whose hash code is to be folded into the hash code for the sequence. |
Returns
Type | Description |
---|---|
System.Int32 | A hash code for a sequence that includes the element. |
Type Parameters
Name | Description |
---|---|
T |
HashEnumerable<T>(IEnumerable<T>)
Hashes a sequence of elements.
Declaration
public static int HashEnumerable<T>(IEnumerable<T> sequence)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | sequence | The sequence to hash. |
Returns
Type | Description |
---|---|
System.Int32 | A hash code for the entire sequence. |
Type Parameters
Name | Description |
---|---|
T | The type of element in the sequence. |
HashEnumerable<T>(IEnumerable<T>, IEqualityComparer<T>)
Hashes a sequence of elements.
Declaration
public static int HashEnumerable<T>(IEnumerable<T> sequence, IEqualityComparer<T> elementComparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | sequence | The sequence to hash. |
System.Collections.Generic.IEqualityComparer<T> | elementComparer | An equality comparer for elements of the sequence. |
Returns
Type | Description |
---|---|
System.Int32 | A hash code for the entire sequence. |
Type Parameters
Name | Description |
---|---|
T | The type of element in the sequence. |
HashUnorderedSet<T>(IEnumerable<T>)
Hashes an unordered set of elements.
Declaration
public static int HashUnorderedSet<T>(IEnumerable<T> sequence)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | sequence | The unordered set to hash. |
Returns
Type | Description |
---|---|
System.Int32 | An ordering-independent hash code for the entire set. |
Type Parameters
Name | Description |
---|---|
T | The type of element in the set. |
HashUnorderedSet<T>(IEnumerable<T>, IEqualityComparer<T>)
Hashes an unordered set of elements.
Declaration
public static int HashUnorderedSet<T>(IEnumerable<T> sequence, IEqualityComparer<T> elementComparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | sequence | The unordered set to hash. |
System.Collections.Generic.IEqualityComparer<T> | elementComparer | An equality comparer for elements of the set. |
Returns
Type | Description |
---|---|
System.Int32 | An ordering-independent hash code for the entire set. |
Type Parameters
Name | Description |
---|---|
T | The type of element in the set. |