Class Collections
  
  
  
  
    Inheritance
    System.Object
    Collections
   
  
    Inherited Members
    
      System.Object.Equals(System.Object)
    
    
      System.Object.GetHashCode()
    
    
      System.Object.GetType()
    
    
      System.Object.MemberwiseClone()
    
    
      System.Object.ReferenceEquals(System.Object, System.Object)
    
    
      System.Object.ToString()
    
   
  
  Assembly: Lucene.Net.dll
  Syntax
  
    public static class Collections
   
  Methods
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  AddAll<T>(ISet<T>, IEnumerable<T>)
  
  
  Declaration
  
    public static bool AddAll<T>(ISet<T> set, IEnumerable<T> elements)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.ISet<T> | 
        set | 
         | 
      
      
        | System.Collections.Generic.IEnumerable<T> | 
        elements | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  EmptyList<T>()
  
  
  Declaration
  
    public static IList<T> EmptyList<T>()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IList<T> | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  EmptyMap<TKey, TValue>()
  
  
  Declaration
  
    public static IDictionary<TKey, TValue> EmptyMap<TKey, TValue>()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<TKey, TValue> | 
         | 
      
    
  
  Type Parameters
  
    
      
        | Name | 
        Description | 
      
    
    
      
        | TKey | 
         | 
      
      
        | TValue | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Equals(Object, Object)
  A helper method to recursively determine equality based on
the values of the collection and all nested collections.
Note this operation currently only supports System.Collections.Generic.IList<T>, System.Collections.Generic.ISet<T>, 
and System.Collections.Generic.IDictionary<TKey, TValue>.
 
  
  Declaration
  
    public static bool Equals(object objA, object objB)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Object | 
        objA | 
         | 
      
      
        | System.Object | 
        objB | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Equals<T>(IList<T>, IList<T>)
  The same implementation of Equals from Java's AbstractList
(the default implementation for all lists)
This algorithm depends on the order of the items in the list. 
It is recursive and will determine equality based on the values of
all nested collections.
Note this operation currently only supports System.Collections.Generic.IList<T>, System.Collections.Generic.ISet<T>, 
and System.Collections.Generic.IDictionary<TKey, TValue>.
 
  
  Declaration
  
    public static bool Equals<T>(IList<T> listA, IList<T> listB)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IList<T> | 
        listA | 
         | 
      
      
        | System.Collections.Generic.IList<T> | 
        listB | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Equals<T>(ISet<T>, ISet<T>)
  The same implementation of Equals from Java's AbstractSet
(the default implementation for all sets)
This algoritm does not depend on the order of the items in the set.
It is recursive and will determine equality based on the values of
all nested collections.
Note this operation currently only supports System.Collections.Generic.IList<T>, System.Collections.Generic.ISet<T>, 
and System.Collections.Generic.IDictionary<TKey, TValue>.
 
  
  Declaration
  
    public static bool Equals<T>(ISet<T> setA, ISet<T> setB)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.ISet<T> | 
        setA | 
         | 
      
      
        | System.Collections.Generic.ISet<T> | 
        setB | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Equals<TKey, TValue>(IDictionary<TKey, TValue>, IDictionary<TKey, TValue>)
  This is the same implemenation of Equals from Java's AbstractMap
(the default implementation of all dictionaries)
This algoritm does not depend on the order of the items in the dictionary.
It is recursive and will determine equality based on the values of
all nested collections.
Note this operation currently only supports System.Collections.Generic.IList<T>, System.Collections.Generic.ISet<T>, 
and System.Collections.Generic.IDictionary<TKey, TValue>.
 
  
  Declaration
  
    public static bool Equals<TKey, TValue>(IDictionary<TKey, TValue> dictionaryA, IDictionary<TKey, TValue> dictionaryB)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<TKey, TValue> | 
        dictionaryA | 
         | 
      
      
        | System.Collections.Generic.IDictionary<TKey, TValue> | 
        dictionaryB | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  Type Parameters
  
    
      
        | Name | 
        Description | 
      
    
    
      
        | TKey | 
         | 
      
      
        | TValue | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetHashCode(Object)
  This method generally assists with the recursive GetHashCode() that
builds a hash code based on all of the values in a collection 
including any nested collections (lists, sets, arrays, and dictionaries).
Note this currently only supports System.Collections.Generic.IList<T>, System.Collections.Generic.ISet<T>, 
and System.Collections.Generic.IDictionary<TKey, TValue>.
 
  
  Declaration
  
    public static int GetHashCode(object obj)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Object | 
        obj | 
        the object to build the hash code for 
 | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Int32 | 
        a value that represents the unique state of all of the values and 
nested collection values in the object, provided the main object itself is 
a collection, otherwise calls System.Object.GetHashCode() on the 
object that is passed. 
 | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetHashCode<T>(IList<T>)
  The same implementation of GetHashCode from Java's AbstractList
(the default implementation for all lists).
This algorithm depends on the order of the items in the list.
It is recursive and will build the hash code based on the values of
all nested collections.
Note this operation currently only supports System.Collections.Generic.IList<T>, System.Collections.Generic.ISet<T>, 
and System.Collections.Generic.IDictionary<TKey, TValue>.
 
  
  Declaration
  
    public static int GetHashCode<T>(IList<T> list)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IList<T> | 
        list | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Int32 | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetHashCode<T>(ISet<T>)
  The same implementation of GetHashCode from Java's AbstractSet
(the default implementation for all sets)
This algorithm does not depend on the order of the items in the set.
It is recursive and will build the hash code based on the values of
all nested collections.
Note this operation currently only supports System.Collections.Generic.IList<T>, System.Collections.Generic.ISet<T>, 
and System.Collections.Generic.IDictionary<TKey, TValue>.
 
  
  Declaration
  
    public static int GetHashCode<T>(ISet<T> set)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.ISet<T> | 
        set | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Int32 | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetHashCode<TKey, TValue>(IDictionary<TKey, TValue>)
  The same implementation of GetHashCode from Java's AbstractMap
(the default implementation for all dictionaries)
This algoritm does not depend on the order of the items in the dictionary.
It is recursive and will build the hash code based on the values of
all nested collections.
Note this operation currently only supports System.Collections.Generic.IList<T>, System.Collections.Generic.ISet<T>, 
and System.Collections.Generic.IDictionary<TKey, TValue>.
 
  
  Declaration
  
    public static int GetHashCode<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<TKey, TValue> | 
        dictionary | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Int32 | 
         | 
      
    
  
  Type Parameters
  
    
      
        | Name | 
        Description | 
      
    
    
      
        | TKey | 
         | 
      
      
        | TValue | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  NewSetFromMap<T, S>(IDictionary<T, Nullable<Boolean>>)
  
  
  Declaration
  
    public static ISet<T> NewSetFromMap<T, S>(IDictionary<T, bool?> map)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<T, System.Nullable<System.Boolean>> | 
        map | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.ISet<T> | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Reverse<T>(IList<T>)
  
  
  Declaration
  
    public static void Reverse<T>(IList<T> list)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IList<T> | 
        list | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ReverseOrder<T>()
  
  
  Declaration
  
    public static IComparer<T> ReverseOrder<T>()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IComparer<T> | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ReverseOrder<T>(IComparer<T>)
  
  
  Declaration
  
    public static IComparer<T> ReverseOrder<T>(IComparer<T> cmp)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IComparer<T> | 
        cmp | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IComparer<T> | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Shuffle<T>(IList<T>)
  
  
  Declaration
  
    public static void Shuffle<T>(IList<T> list)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IList<T> | 
        list | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Shuffle<T>(IList<T>, Random)
  
  
  Declaration
  
    public static void Shuffle<T>(IList<T> list, Random random)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IList<T> | 
        list | 
         | 
      
      
        | System.Random | 
        random | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Singleton<T>(T)
  
  
  Declaration
  
    public static ISet<T> Singleton<T>(T o)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | T | 
        o | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.ISet<T> | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  SingletonMap<TKey, TValue>(TKey, TValue)
  
  
  Declaration
  
    public static IDictionary<TKey, TValue> SingletonMap<TKey, TValue>(TKey key, TValue value)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | TKey | 
        key | 
         | 
      
      
        | TValue | 
        value | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<TKey, TValue> | 
         | 
      
    
  
  Type Parameters
  
    
      
        | Name | 
        Description | 
      
    
    
      
        | TKey | 
         | 
      
      
        | TValue | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Swap<T>(IList<T>, Int32, Int32)
  
  
  Declaration
  
    public static void Swap<T>(IList<T> list, int index1, int index2)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IList<T> | 
        list | 
         | 
      
      
        | System.Int32 | 
        index1 | 
         | 
      
      
        | System.Int32 | 
        index2 | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ToString(Object)
  This is a helper method that assists with recursively building
a string of the current collection and all nested collections.
 
  
  Declaration
  
    public static string ToString(object obj)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Object | 
        obj | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.String | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ToString(Object, CultureInfo)
  This is a helper method that assists with recursively building
a string of the current collection and all nested collections, plus the ability
to specify culture for formatting of nested numbers and dates. Note that
this overload will change the culture of the current thread.
 
  
  Declaration
  
    public static string ToString(object obj, CultureInfo culture)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Object | 
        obj | 
         | 
      
      
        | System.Globalization.CultureInfo | 
        culture | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.String | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ToString<T>(ICollection<T>)
  This is the same implementation of ToString from Java's AbstractCollection
(the default implementation for all sets and lists)
 
  
  Declaration
  
    public static string ToString<T>(ICollection<T> collection)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.ICollection<T> | 
        collection | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.String | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ToString<T>(ICollection<T>, CultureInfo)
  This is the same implementation of ToString from Java's AbstractCollection
(the default implementation for all sets and lists), plus the ability
to specify culture for formatting of nested numbers and dates. Note that
this overload will change the culture of the current thread.
 
  
  Declaration
  
    public static string ToString<T>(ICollection<T> collection, CultureInfo culture)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.ICollection<T> | 
        collection | 
         | 
      
      
        | System.Globalization.CultureInfo | 
        culture | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.String | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ToString<TKey, TValue>(IDictionary<TKey, TValue>)
  This is the same implementation of ToString from Java's AbstractMap
(the default implementation for all dictionaries)
 
  
  Declaration
  
    public static string ToString<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<TKey, TValue> | 
        dictionary | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.String | 
         | 
      
    
  
  Type Parameters
  
    
      
        | Name | 
        Description | 
      
    
    
      
        | TKey | 
         | 
      
      
        | TValue | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ToString<TKey, TValue>(IDictionary<TKey, TValue>, CultureInfo)
  This is the same implementation of ToString from Java's AbstractMap
(the default implementation for all dictionaries), plus the ability
to specify culture for formatting of nested numbers and dates. Note that
this overload will change the culture of the current thread.
 
  
  Declaration
  
    public static string ToString<TKey, TValue>(IDictionary<TKey, TValue> dictionary, CultureInfo culture)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<TKey, TValue> | 
        dictionary | 
         | 
      
      
        | System.Globalization.CultureInfo | 
        culture | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.String | 
         | 
      
    
  
  Type Parameters
  
    
      
        | Name | 
        Description | 
      
    
    
      
        | TKey | 
         | 
      
      
        | TValue | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  UnmodifiableList<T>(IList<T>)
  
  
  Declaration
  
    public static IList<T> UnmodifiableList<T>(IList<T> list)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IList<T> | 
        list | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IList<T> | 
         | 
      
    
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  UnmodifiableMap<TKey, TValue>(IDictionary<TKey, TValue>)
  
  
  Declaration
  
    public static IDictionary<TKey, TValue> UnmodifiableMap<TKey, TValue>(IDictionary<TKey, TValue> d)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<TKey, TValue> | 
        d | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<TKey, TValue> | 
         | 
      
    
  
  Type Parameters
  
    
      
        | Name | 
        Description | 
      
    
    
      
        | TKey | 
         | 
      
      
        | TValue | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  UnmodifiableSet<T>(ISet<T>)
  
  
  Declaration
  
    public static ISet<T> UnmodifiableSet<T>(ISet<T> list)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.ISet<T> | 
        list | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.ISet<T> | 
         | 
      
    
  
  Type Parameters