Show / Hide Table of Contents

    Interface ICollection<T>

    The simplest interface of a main stream generic collection with lookup, insertion and removal operations.

    Inherited Members
    IExtensible<T>.AllowsDuplicates
    IExtensible<T>.EqualityComparer
    IExtensible<T>.DuplicatesByCounting
    IExtensible<T>.AddAll(System.Collections.Generic.IEnumerable<T>)
    IExtensible<T>.Check()
    ICollectionValue<T>.ListenableEvents
    ICollectionValue<T>.ActiveEvents
    ICollectionValue<T>.CollectionChanged
    ICollectionValue<T>.CollectionCleared
    ICollectionValue<T>.ItemsAdded
    ICollectionValue<T>.ItemInserted
    ICollectionValue<T>.ItemsRemoved
    ICollectionValue<T>.ItemRemovedAt
    ICollectionValue<T>.IsEmpty
    ICollectionValue<T>.CountSpeed
    ICollectionValue<T>.ToArray()
    ICollectionValue<T>.Apply(Action<T>)
    ICollectionValue<T>.Exists(Func<T, Boolean>)
    ICollectionValue<T>.Find(Func<T, Boolean>, T)
    ICollectionValue<T>.All(Func<T, Boolean>)
    ICollectionValue<T>.Choose()
    ICollectionValue<T>.Filter(Func<T, Boolean>)
    IShowable.Show(System.Text.StringBuilder, Int32, IFormatProvider)
    Namespace: Lucene.Net.Support.C5
    Assembly: Lucene.Net.dll
    Syntax
    public interface ICollection<T> : IExtensible<T>, ICollectionValue<T>, System.Collections.Generic.IEnumerable<T>, IShowable, IFormattable, System.Collections.Generic.ICollection<T>
    Type Parameters
    Name Description
    T

    Properties

    | Improve this Doc View Source

    ContainsSpeed

    The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant).

    See C5.Speed for the set of symbols.

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

    A characterization of the speed of lookup operations (

    Contains()
    etc.) of the implementation of this collection.

    | Improve this Doc View Source

    Count

    Declaration
    int Count { get; }
    Property Value
    Type Description
    System.Int32

    The number of items in this collection

    | Improve this Doc View Source

    IsReadOnly

    If true any call of an updating operation will throw an

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

    True if this collection is read-only.

    Methods

    | Improve this Doc View Source

    Add(T)

    Add an item to this collection if possible. If this collection has set semantics, the item will be added if not already in the collection. If bag semantics, the item will always be added.

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

    The item to add.

    Returns
    Type Description
    System.Boolean

    True if item was added.

    | Improve this Doc View Source

    Clear()

    Remove all items from this collection.

    Declaration
    void Clear()
    | Improve this Doc View Source

    Contains(T)

    Check if this collection contains (an item equivalent to according to the itemequalityComparer) a particular value.

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

    The value to check for.

    Returns
    Type Description
    System.Boolean

    True if the items is in this collection.

    | Improve this Doc View Source

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

    Check whether this collection contains all the values in another collection. If this collection has bag semantics (

    AllowsDuplicates==true
    ) the check is made with respect to multiplicities, else multiplicities are not taken into account.

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

    The

    Returns
    Type Description
    System.Boolean

    True if all values in

    items
    is in this collection.

    | Improve this Doc View Source

    ContainsCount(T)

    Count the number of items of the collection equal to a particular value. Returns 0 if and only if the value is not in the collection.

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

    The value to count.

    Returns
    Type Description
    System.Int32

    The number of copies found.

    | Improve this Doc View Source

    CopyTo(T[], Int32)

    Copy the items of this collection to a contiguous part of an array.

    Declaration
    void CopyTo(T[] array, int index)
    Parameters
    Type Name Description
    T[] array

    The array to copy to

    System.Int32 index

    The index at which to copy the first item

    | Improve this Doc View Source

    Find(ref T)

    Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, return in the ref argument (a binary copy of) the actual value found.

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

    The value to look for.

    Returns
    Type Description
    System.Boolean

    True if the items is in this collection.

    | Improve this Doc View Source

    FindOrAdd(ref T)

    Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, return in the ref argument (a binary copy of) the actual value found. Else, add the item to the collection.

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

    The value to look for.

    Returns
    Type Description
    System.Boolean

    True if the item was found (hence not added).

    | Improve this Doc View Source

    GetUnsequencedHashCode()

    The unordered collection hashcode is defined as the sum of

    h(hashcode(item))
    over the items

    of the collection, where the function

    h
    is a function from int to int of the form
     t -> (a0*t+b0)^(a1*t+b1)^(a2*t+b2)
    , where the ax and bx are the same for all collection classes.

    The current implementation uses fixed values for the ax and bx, specified as constants in the code.

    Declaration
    int GetUnsequencedHashCode()
    Returns
    Type Description
    System.Int32

    The unordered hashcode of this collection.

    | Improve this Doc View Source

    ItemMultiplicities()

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

    Remove(T)

    Remove a particular item from this collection. If the collection has bag semantics only one copy equivalent to the supplied item is removed.

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

    The value to remove.

    Returns
    Type Description
    System.Boolean

    True if the item was found (and removed).

    | Improve this Doc View Source

    Remove(T, out T)

    Remove a particular item from this collection if found. If the collection has bag semantics only one copy equivalent to the supplied item is removed, which one is implementation dependent. If an item was removed, report a binary copy of the actual item removed in the argument.

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

    The value to remove.

    T removeditem

    The value removed if any.

    Returns
    Type Description
    System.Boolean

    True if the item was found (and removed).

    | Improve this Doc View Source

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

    Remove all items in another collection from this one. If this collection has bag semantics, take multiplicities into account.

    Declaration
    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 items equivalent to a given value.

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

    The value to remove.

    | Improve this Doc View Source

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

    Remove all items not in some other collection from this one. If this collection has bag semantics, take multiplicities into account.

    Declaration
    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

    UniqueItems()

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

    UnsequencedEquals(ICollection<T>)

    Compare the contents of this collection to another one without regards to the sequence order. The comparison will use this collection's itemequalityComparer to compare individual items.

    Declaration
    bool UnsequencedEquals(ICollection<T> otherCollection)
    Parameters
    Type Name Description
    ICollection<T> otherCollection

    The collection to compare to.

    Returns
    Type Description
    System.Boolean

    True if this collection and that contains the same items.

    | Improve this Doc View Source

    Update(T)

    Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection with a (binary copy of) the supplied value. If the collection has bag semantics, it depends on the value of DuplicatesByCounting if this updates all equivalent copies in the collection or just one.

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

    Value to update.

    Returns
    Type Description
    System.Boolean

    True if the item was found and hence updated.

    | Improve this Doc View Source

    Update(T, out T)

    Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection with a (binary copy of) the supplied value. If the collection has bag semantics, it depends on the value of DuplicatesByCounting if this updates all equivalent copies in the collection or just one.

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

    Value to update.

    T olditem

    On output the olditem, if found.

    Returns
    Type Description
    System.Boolean

    True if the item was found and hence updated.

    | Improve this Doc View Source

    UpdateOrAdd(T)

    Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection to with a binary copy of the supplied value; else add the value to the collection.

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

    Value to add or update.

    Returns
    Type Description
    System.Boolean

    True if the item was found and updated (hence not added).

    | Improve this Doc View Source

    UpdateOrAdd(T, out T)

    Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection to with a binary copy of the supplied value; else add the value to the collection.

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

    Value to add or update.

    T olditem

    On output the olditem, if found.

    Returns
    Type Description
    System.Boolean

    True if the item was found and updated (hence not added).

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