Show / Hide Table of Contents

    Class HashSet<T>

    A set collection class based on linear hashing

    Inheritance
    System.Object
    EnumerableBase<T>
    CollectionValueBase<T>
    CollectionBase<T>
    HashSet<T>
    Implements
    ICollection<T>
    IExtensible<T>
    ICollectionValue<T>
    System.Collections.Generic.IEnumerable<T>
    IShowable
    IFormattable
    System.Collections.Generic.ICollection<T>
    Inherited Members
    CollectionBase<T>.isReadOnlyBase
    CollectionBase<T>.stamp
    CollectionBase<T>.size
    CollectionBase<T>.itemequalityComparer
    CollectionBase<T>.checkRange(Int32, Int32)
    CollectionBase<T>.ComputeHashCode(ICollectionValue<T>, System.Collections.Generic.IEqualityComparer<T>)
    CollectionBase<T>.StaticEquals(ICollection<T>, ICollection<T>, System.Collections.Generic.IEqualityComparer<T>)
    CollectionBase<T>.GetUnsequencedHashCode()
    CollectionBase<T>.UnsequencedEquals(ICollection<T>)
    CollectionBase<T>.modifycheck(Int32)
    CollectionBase<T>.updatecheck()
    CollectionBase<T>.IsReadOnly
    CollectionBase<T>.Count
    CollectionBase<T>.CountSpeed
    CollectionBase<T>.EqualityComparer
    CollectionBase<T>.IsEmpty
    CollectionValueBase<T>.ActiveEvents
    CollectionValueBase<T>.CollectionChanged
    CollectionValueBase<T>.raiseCollectionChanged()
    CollectionValueBase<T>.CollectionCleared
    CollectionValueBase<T>.raiseCollectionCleared(Boolean, Int32)
    CollectionValueBase<T>.raiseCollectionCleared(Boolean, Int32, Nullable<Int32>)
    CollectionValueBase<T>.ItemsAdded
    CollectionValueBase<T>.raiseItemsAdded(T, Int32)
    CollectionValueBase<T>.ItemsRemoved
    CollectionValueBase<T>.raiseItemsRemoved(T, Int32)
    CollectionValueBase<T>.ItemInserted
    CollectionValueBase<T>.raiseItemInserted(T, Int32)
    CollectionValueBase<T>.ItemRemovedAt
    CollectionValueBase<T>.raiseItemRemovedAt(T, Int32)
    CollectionValueBase<T>.raiseForSetThis(Int32, T, T)
    CollectionValueBase<T>.raiseForInsert(Int32, T)
    CollectionValueBase<T>.raiseForRemove(T)
    CollectionValueBase<T>.raiseForRemove(T, Int32)
    CollectionValueBase<T>.raiseForRemoveAt(Int32, T)
    CollectionValueBase<T>.raiseForUpdate(T, T)
    CollectionValueBase<T>.raiseForUpdate(T, T, Int32)
    CollectionValueBase<T>.raiseForAdd(T)
    CollectionValueBase<T>.raiseForRemoveAll(ICollectionValue<T>)
    CollectionValueBase<T>.CopyTo(T[], Int32)
    CollectionValueBase<T>.Apply(Action<T>)
    CollectionValueBase<T>.Exists(Func<T, Boolean>)
    CollectionValueBase<T>.Find(Func<T, Boolean>, T)
    CollectionValueBase<T>.All(Func<T, Boolean>)
    CollectionValueBase<T>.Filter(Func<T, Boolean>)
    CollectionValueBase<T>.Show(System.Text.StringBuilder, Int32, IFormatProvider)
    CollectionValueBase<T>.ToString(String, IFormatProvider)
    CollectionValueBase<T>.ToString()
    EnumerableBase<T>.countItems(System.Collections.Generic.IEnumerable<T>)
    Namespace: Lucene.Net.Support.C5
    Assembly: Lucene.Net.dll
    Syntax
    public class HashSet<T> : CollectionBase<T>, ICollection<T>, IExtensible<T>, ICollectionValue<T>, System.Collections.Generic.IEnumerable<T>, IShowable, IFormattable, System.Collections.Generic.ICollection<T>
    Type Parameters
    Name Description
    T

    Constructors

    | Improve this Doc View Source

    HashSet()

    Declaration
    public HashSet()
    | Improve this Doc View Source

    HashSet(MemoryType)

    Create a hash set with natural item equalityComparer and default fill threshold (66%) and initial table size (16).

    Declaration
    public HashSet(MemoryType memoryType = MemoryType.Normal)
    Parameters
    Type Name Description
    MemoryType memoryType
    | Improve this Doc View Source

    HashSet(System.Collections.Generic.IEqualityComparer<T>, MemoryType)

    Create a hash set with external item equalityComparer and default fill threshold (66%) and initial table size (16).

    Declaration
    public HashSet(System.Collections.Generic.IEqualityComparer<T> itemequalityComparer, MemoryType memoryType = MemoryType.Normal)
    Parameters
    Type Name Description
    System.Collections.Generic.IEqualityComparer<T> itemequalityComparer

    The external item equalitySCG.Comparer

    MemoryType memoryType
    | Improve this Doc View Source

    HashSet(Int32, System.Collections.Generic.IEqualityComparer<T>, MemoryType)

    Create a hash set with external item equalityComparer and default fill threshold (66%)

    Declaration
    public HashSet(int capacity, System.Collections.Generic.IEqualityComparer<T> itemequalityComparer, MemoryType memoryType = MemoryType.Normal)
    Parameters
    Type Name Description
    System.Int32 capacity

    Initial table size (rounded to power of 2, at least 16)

    System.Collections.Generic.IEqualityComparer<T> itemequalityComparer

    The external item equalitySCG.Comparer

    MemoryType memoryType
    | Improve this Doc View Source

    HashSet(Int32, Double, System.Collections.Generic.IEqualityComparer<T>, MemoryType)

    Create a hash set with external item equalityComparer.

    Declaration
    public HashSet(int capacity, double fill, System.Collections.Generic.IEqualityComparer<T> itemequalityComparer, MemoryType memoryType = MemoryType.Normal)
    Parameters
    Type Name Description
    System.Int32 capacity

    Initial table size (rounded to power of 2, at least 16)

    System.Double fill

    Fill threshold (in range 10% to 90%)

    System.Collections.Generic.IEqualityComparer<T> itemequalityComparer

    The external item equalitySCG.Comparer

    MemoryType memoryType

    Properties

    | Improve this Doc View Source

    AllowsDuplicates

    Report if this is a set collection.

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

    Always false

    | Improve this Doc View Source

    ContainsSpeed

    The complexity of the Contains operation

    Declaration
    public virtual Speed ContainsSpeed { get; }
    Property Value
    Type Description
    Speed

    Always returns Speed.Constant

    | Improve this Doc View Source

    DuplicatesByCounting

    By convention this is true for any collection with set semantics.

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

    True if only one representative of a group of equal items is kept in the collection together with the total count.

    | Improve this Doc View Source

    Features

    Show which implementation features was chosen at compilation time

    Declaration
    public static HashSet<T>.Feature Features { get; }
    Property Value
    Type Description
    HashSet.Feature<>
    | Improve this Doc View Source

    ListenableEvents

    Declaration
    public override EventTypeEnum ListenableEvents { get; }
    Property Value
    Type Description
    EventTypeEnum
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<T>.ListenableEvents

    Methods

    | Improve this Doc View Source

    Add(T)

    Add an item to this set.

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

    The item to add.

    Returns
    Type Description
    System.Boolean

    True if item was added (i.e. not found)

    | Improve this Doc View Source

    AddAll(System.Collections.Generic.IEnumerable<T>)

    Add the elements from another collection with a more specialized item type to this collection. Since this collection has set semantics, only items not already in the collection will be added.

    Declaration
    public virtual void AddAll(System.Collections.Generic.IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    The items to add

    | Improve this Doc View Source

    BucketCostDistribution()

    Produce statistics on distribution of bucket sizes. Current implementation is incomplete.

    Declaration
    public ISortedDictionary<int, int> BucketCostDistribution()
    Returns
    Type Description
    ISortedDictionary<System.Int32, System.Int32>

    Histogram data.

    | Improve this Doc View Source

    Check()

    Test internal structure of data (invariants)

    Declaration
    public virtual bool Check()
    Returns
    Type Description
    System.Boolean

    True if pass

    | Improve this Doc View Source

    Choose()

    Choose some item of this collection.

    Declaration
    public override T Choose()
    Returns
    Type Description
    T
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<T>.Choose()
    Exceptions
    Type Condition
    NoSuchItemException

    if collection is empty.

    | Improve this Doc View Source

    Clear()

    Remove all items from the set, resetting internal table to initial size.

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

    Contains(T)

    Check if an item is in the set

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

    The item to look for

    Returns
    Type Description
    System.Boolean

    True if set contains item

    | Improve this Doc View Source

    ContainsAll(System.Collections.Generic.IEnumerable<T>)

    Check if all items in a supplied collection is in this set (ignoring multiplicities).

    Declaration
    public virtual bool ContainsAll(System.Collections.Generic.IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    The items to look for.

    Returns
    Type Description
    System.Boolean

    True if all items are found.

    | Improve this Doc View Source

    ContainsCount(T)

    Count the number of times an item is in this set (either 0 or 1).

    Declaration
    public virtual int ContainsCount(T item)
    Parameters
    Type Name Description
    T item

    The item to look for.

    Returns
    Type Description
    System.Int32

    1 if item is in set, 0 else

    | Improve this Doc View Source

    Find(ref T)

    Check if an item (collection equal to a given one) is in the set and if so report the actual item object found.

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

    On entry, the item to look for. On exit the item found, if any

    Returns
    Type Description
    System.Boolean

    True if set contains item

    | Improve this Doc View Source

    FindOrAdd(ref T)

    Check if an item (collection equal to a given one) is in the set. If found, report the actual item object in the set, else add the supplied one.

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

    On entry, the item to look for or add. On exit the actual object found, if any.

    Returns
    Type Description
    System.Boolean

    True if item was found

    | Improve this Doc View Source

    GetEnumerator()

    Create an enumerator for this set.

    Declaration
    public override System.Collections.Generic.IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<T>

    The enumerator

    Overrides
    Lucene.Net.Support.C5.EnumerableBase<T>.GetEnumerator()
    | Improve this Doc View Source

    ItemMultiplicities()

    Declaration
    public virtual ICollectionValue<KeyValuePair<T, int>> ItemMultiplicities()
    Returns
    Type Description
    ICollectionValue<KeyValuePair<T, System.Int32>>
    | Improve this Doc View Source

    Remove(T)

    Remove an item from the set

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

    The item to remove

    Returns
    Type Description
    System.Boolean

    True if item was (found and) removed

    | Improve this Doc View Source

    Remove(T, out T)

    Remove an item from the set, reporting the actual matching item object.

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

    The value to remove.

    T removeditem

    The removed value.

    Returns
    Type Description
    System.Boolean

    True if item was found.

    | Improve this Doc View Source

    RemoveAll(System.Collections.Generic.IEnumerable<T>)

    Remove all items in a supplied collection from this set.

    Declaration
    public virtual void RemoveAll(System.Collections.Generic.IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    The items to remove.

    | Improve this Doc View Source

    RemoveAllCopies(T)

    Remove all (at most 1) copies of item from this set.

    Declaration
    public virtual void RemoveAllCopies(T item)
    Parameters
    Type Name Description
    T item

    The item to remove

    | Improve this Doc View Source

    RetainAll(System.Collections.Generic.IEnumerable<T>)

    Remove all items not in a supplied collection from this set.

    Declaration
    public virtual void RetainAll(System.Collections.Generic.IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    The items to retain

    | Improve this Doc View Source

    ToArray()

    Create an array containing all items in this set (in enumeration order).

    Declaration
    public override T[] ToArray()
    Returns
    Type Description
    T[]

    The array

    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<T>.ToArray()
    | Improve this Doc View Source

    UniqueItems()

    Declaration
    public virtual ICollectionValue<T> UniqueItems()
    Returns
    Type Description
    ICollectionValue<T>
    | Improve this Doc View Source

    Update(T)

    Check if an item (collection equal to a given one) is in the set and if so replace the item object in the set with the supplied one.

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

    The item object to update with

    Returns
    Type Description
    System.Boolean

    True if item was found (and updated)

    | Improve this Doc View Source

    Update(T, out T)

    Check if an item (collection equal to a given one) is in the set and if so replace the item object in the set with the supplied one.

    Declaration
    public virtual bool Update(T item, out T olditem)
    Parameters
    Type Name Description
    T item

    The item object to update with

    T olditem
    Returns
    Type Description
    System.Boolean

    True if item was found (and updated)

    | Improve this Doc View Source

    UpdateOrAdd(T)

    Check if an item (collection equal to a supplied one) is in the set and if so replace the item object in the set with the supplied one; else add the supplied one.

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

    The item to look for and update or add

    Returns
    Type Description
    System.Boolean

    True if item was updated

    | Improve this Doc View Source

    UpdateOrAdd(T, out T)

    Check if an item (collection equal to a supplied one) is in the set and if so replace the item object in the set with the supplied one; else add the supplied one.

    Declaration
    public virtual bool UpdateOrAdd(T item, out T olditem)
    Parameters
    Type Name Description
    T item

    The item to look for and update or add

    T olditem
    Returns
    Type Description
    System.Boolean

    True if item was updated

    Implements

    ICollection<T>
    IExtensible<T>
    ICollectionValue<T>
    System.Collections.Generic.IEnumerable<>
    IShowable
    IFormattable
    System.Collections.Generic.ICollection<>
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)