Class CollectionUtil
Methods for manipulating (sorting) collections. Sort methods work directly on the supplied lists and don't copy to/from arrays before/after. For medium size collections as used in the Lucene indexer that is much more efficient.
Inheritance
Inherited Members
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public static class CollectionUtil
Methods
| Improve this Doc View SourceIntroSort<T>(IList<T>)
Sorts the given random access System.Collections.Generic.IList<T> in natural order. This method uses the intro sort algorithm, but falls back to insertion sort for small lists.
Declaration
public static void IntroSort<T>(IList<T> list)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T> | list | This System.Collections.Generic.IList<T> |
Type Parameters
Name | Description |
---|---|
T |
IntroSort<T>(IList<T>, IComparer<T>)
Sorts the given System.Collections.Generic.IList<T> using the System.Collections.Generic.IComparer<T>. This method uses the intro sort algorithm, but falls back to insertion sort for small lists.
Declaration
public static void IntroSort<T>(IList<T> list, IComparer<T> comp)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T> | list | This System.Collections.Generic.IList<T> |
System.Collections.Generic.IComparer<T> | comp | The System.Collections.Generic.IComparer<T> to use for the sort. |
Type Parameters
Name | Description |
---|---|
T |
TimSort<T>(IList<T>)
Sorts the given System.Collections.Generic.IList<T> in natural order. This method uses the Tim sort algorithm, but falls back to binary sort for small lists.
Declaration
public static void TimSort<T>(IList<T> list)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T> | list | This System.Collections.Generic.IList<T> |
Type Parameters
Name | Description |
---|---|
T |
TimSort<T>(IList<T>, IComparer<T>)
Sorts the given System.Collections.Generic.IList<T> using the System.Collections.Generic.IComparer<T>. This method uses the Tim sort algorithm, but falls back to binary sort for small lists.
Declaration
public static void TimSort<T>(IList<T> list, IComparer<T> comp)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T> | list | this System.Collections.Generic.IList<T> |
System.Collections.Generic.IComparer<T> | comp | The System.Collections.Generic.IComparer<T> to use for the sort. |
Type Parameters
Name | Description |
---|---|
T |