Show / Hide Table of Contents

    Class EquatableSet<T>

    Represents a strongly typed set of objects. Provides methods to manipulate the set. Also provides functionality to compare sets against each other through an implementations of , or to wrap an existing set to use the same comparison logic as this one while not affecting any of its other functionality.

    Inheritance
    System.Object
    EquatableSet<T>
    Implements
    IEquatable<ISet<T>>
    Namespace: Lucene.Net.Support
    Assembly: Lucene.Net.dll
    Syntax
    public class EquatableSet<T> : ISet<T>, IEquatable<ISet<T>>
    Type Parameters
    Name Description
    T

    The type of elements in the list.

    Constructors

    | Improve this Doc View Source

    EquatableSet()

    Initializes a new instance of the EquatableSet<T> class that is empty and has the default initial capacity.

    Declaration
    public EquatableSet()
    | Improve this Doc View Source

    EquatableSet(ICollection<T>)

    Initializes a new instance of the EquatableSet<T> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.

    Declaration
    public EquatableSet(ICollection<T> collection)
    Parameters
    Type Name Description
    ICollection<T> collection

    The collection whose elements are copied to the new set.

    | Improve this Doc View Source

    EquatableSet(IEnumerable<T>, IEqualityComparer<T>)

    Initializes a new instance of the EquatableSet<T> class that uses the specified equality comparer for the set type, contains elements copied from the specified collection, and has sufficient capacity to accommodate the number of elements copied.

    Declaration
    public EquatableSet(IEnumerable<T> collection, IEqualityComparer<T> comparer)
    Parameters
    Type Name Description
    IEnumerable<T> collection

    The collection whose elements are copied to the new set.

    IEqualityComparer<T> comparer

    The implementation to use when comparing values in the set, or null to use the default implementation for the set type.

    | Improve this Doc View Source

    EquatableSet(IEqualityComparer<T>)

    Initializes a new instance of the EquatableSet<T> class that is empty and uses the specified equality comparer for the set type.

    Declaration
    public EquatableSet(IEqualityComparer<T> comparer)
    Parameters
    Type Name Description
    IEqualityComparer<T> comparer

    The implementation to use when comparing values in the set, or null to use the default implementation for the set type.

    | Improve this Doc View Source

    EquatableSet(ISet<T>, Boolean)

    Initializes a new instance of EquatableSet<T>.

    If the wrap parameter is true, the collection is used as is without doing a copy operation. Otherwise, the collection is copied (which is the same operation as the EquatableSet(ICollection<T>) overload).

    The internal collection is used for all operations except for Equals(Object), GetHashCode(), and ToString(), which are all based on deep analysis of this collection and any nested collections.

    Declaration
    public EquatableSet(ISet<T> collection, bool wrap)
    Parameters
    Type Name Description
    ISet<T> collection

    The collection that will either be wrapped or copied depending on the value of wrap.

    System.Boolean wrap

    true to wrap an existing without copying, or false to copy the collection into a new .

    Properties

    | Improve this Doc View Source

    Count

    Gets the number of elements contained in the EquatableSet<T>.

    Declaration
    public virtual int Count { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    IsReadOnly

    Gets a value indicating whether the EquatableSet<T> is read-only.

    Declaration
    public virtual bool IsReadOnly { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    Add(T)

    Adds an element to the current set and returns a value to indicate if the element was successfully added.

    Declaration
    public virtual bool Add(T item)
    Parameters
    Type Name Description
    T item

    The element to add to the set.

    Returns
    Type Description
    System.Boolean

    true if the element is added to the set; false if the element is already in the set.

    | Improve this Doc View Source

    Clear()

    Removes all items from the EquatableSet<T>.

    Declaration
    public virtual void Clear()
    | Improve this Doc View Source

    Clone()

    Clones the EquatableSet<T>.

    Declaration
    public virtual object Clone()
    Returns
    Type Description
    System.Object

    A new shallow clone of this EquatableSet<T>.

    Remarks

    This is a shallow clone.

    | Improve this Doc View Source

    Contains(T)

    Determines whether the EquatableSet<T> contains a specific value.

    Declaration
    public virtual bool Contains(T item)
    Parameters
    Type Name Description
    T item

    The object to locate in the EquatableSet<T>.

    Returns
    Type Description
    System.Boolean

    true if item is found in the EquatableSet<T>; otherwise, false.

    | Improve this Doc View Source

    CopyTo(T[], Int32)

    Copies the elements of the EquatableSet<T> to an , starting at a particular index.

    Declaration
    public virtual void CopyTo(T[] array, int arrayIndex)
    Parameters
    Type Name Description
    T[] array

    The one-dimensional that is the destination of the elements copied from EquatableSet<T>. The must have zero-based indexing.

    System.Int32 arrayIndex

    The zero-based index in array at which copying begins.

    | Improve this Doc View Source

    Equals(ISet<T>)

    Compares this sequence to other, returning true if they are equal, false otherwise.

    The comparison takes into consideration any values in this collection and values of any nested collections, but does not take into consideration the data type. Therefore, EquatableSet<T> can equal any with the exact same values (in any order).

    Declaration
    public virtual bool Equals(ISet<T> other)
    Parameters
    Type Name Description
    ISet<T> other

    The other object to compare against.

    Returns
    Type Description
    System.Boolean

    true if the sequence in other is the same as this one.

    | Improve this Doc View Source

    Equals(Object)

    If the object passed implements , compares this sequence to other, returning true if they are equal, false otherwise.

    The comparison takes into consideration any values in this collection and values of any nested collections, but does not take into consideration the data type. Therefore, EquatableSet<T> can equal any with the exact same values (in any order).

    Declaration
    public override bool Equals(object other)
    Parameters
    Type Name Description
    System.Object other

    The other object to compare against.

    Returns
    Type Description
    System.Boolean

    true if the sequence in other is the same as this one.

    | Improve this Doc View Source

    ExceptWith(IEnumerable<T>)

    Removes all elements in the specified collection from the current set.

    Declaration
    public virtual void ExceptWith(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection of items to remove from the set.

    | Improve this Doc View Source

    GetEnumerator()

    Returns an enumerator that iterates through the collection.

    Declaration
    public virtual IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    IEnumerator<T>

    An enumerator that can be used to iterate through the collection.

    | Improve this Doc View Source

    GetHashCode()

    Returns the hash code value for this list.

    The hash code determination takes into consideration any values in this collection and values of any nested collections, but does not take into consideration the data type. Therefore, the hash codes will be exactly the same for this EquatableSet<T> and another with the same values (in any order).

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    the hash code value for this list

    | Improve this Doc View Source

    IntersectWith(IEnumerable<T>)

    Modifies the current set so that it contains only elements that are also in a specified collection.

    Declaration
    public virtual void IntersectWith(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current set.

    | Improve this Doc View Source

    IsProperSubsetOf(IEnumerable<T>)

    Determines whether the current set is a proper (strict) subset of a specified collection.

    Declaration
    public virtual bool IsProperSubsetOf(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current set.

    Returns
    Type Description
    System.Boolean

    true if the current set is a proper subset of other; otherwise, false.

    | Improve this Doc View Source

    IsProperSupersetOf(IEnumerable<T>)

    Determines whether the current set is a proper (strict) superset of a specified collection.

    Declaration
    public virtual bool IsProperSupersetOf(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current set.

    Returns
    Type Description
    System.Boolean

    true if the current set is a proper superset of other; otherwise, false.

    | Improve this Doc View Source

    IsSubsetOf(IEnumerable<T>)

    Determines whether a set is a subset of a specified collection.

    Declaration
    public virtual bool IsSubsetOf(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current set.

    Returns
    Type Description
    System.Boolean

    true if the current set is a subset of other; otherwise, false.

    | Improve this Doc View Source

    IsSupersetOf(IEnumerable<T>)

    Determines whether the current set is a superset of a specified collection.

    Declaration
    public virtual bool IsSupersetOf(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current set.

    Returns
    Type Description
    System.Boolean

    true if the current set is a superset of other; otherwise, false.

    | Improve this Doc View Source

    Overlaps(IEnumerable<T>)

    Determines whether the current set overlaps with the specified collection.

    Declaration
    public virtual bool Overlaps(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current set.

    Returns
    Type Description
    System.Boolean

    true if the current set and other share at least one common element; otherwise, false.

    | Improve this Doc View Source

    Remove(T)

    Removes the first occurrence of a specific object from the EquatableSet<T>.

    Declaration
    public virtual bool Remove(T item)
    Parameters
    Type Name Description
    T item

    The object to remove from the EquatableSet<T>.

    Returns
    Type Description
    System.Boolean

    true if item was successfully removed from the EquatableSet<T>; otherwise, false. This method also returns false if item is not found in the original EquatableSet<T>.

    | Improve this Doc View Source

    SetEquals(IEnumerable<T>)

    Determines whether the current set and the specified collection contain the same elements.

    Declaration
    public virtual bool SetEquals(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current set.

    Returns
    Type Description
    System.Boolean

    true if the current set is equal to other; otherwise, false.

    | Improve this Doc View Source

    SymmetricExceptWith(IEnumerable<T>)

    Modifies the current set so that it contains only elements that are present either in the current set or in the specified collection, but not both.

    Declaration
    public virtual void SymmetricExceptWith(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current set.

    | Improve this Doc View Source

    ToString()

    Returns a string representation of this collection (and any nested collections). The string representation consists of a list of the collection's elements in the order they are returned by its enumerator, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    a string representation of this collection

    | Improve this Doc View Source

    UnionWith(IEnumerable<T>)

    Modifies the current set so that it contains all elements that are present in the current set, in the specified collection, or in both.

    Declaration
    public virtual void UnionWith(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current set.

    Implements

    IEquatable<>
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)