Class ListExtensions
Extensions to IList<T>.
Inherited Members
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public static class ListExtensions
Methods
AddRange<T>(IList<T>, IEnumerable<T>)
Adds the elements of the specified collection to the end of the IList<T>.
Declaration
public static void AddRange<T>(this IList<T> list, IEnumerable<T> collection)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | The list to add to. |
IEnumerable<T> | collection | The collection whose elements should be added to the end of the IList<T>.
The collection itself cannot be |
Type Parameters
Name | Description |
---|---|
T | The element type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
IntroSort<T>(IList<T>)
Sorts the given IList<T> using the IComparer<T>. This method uses the intro sort algorithm, but falls back to insertion sort for small lists.
Declaration
public static void IntroSort<T>(this IList<T> list)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | this IList<T> |
Type Parameters
Name | Description |
---|---|
T |
IntroSort<T>(IList<T>, IComparer<T>)
Sorts the given IList<T> using the IComparer<T>. This method uses the intro sort algorithm, but falls back to insertion sort for small lists.
Declaration
public static void IntroSort<T>(this IList<T> list, IComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | this IList<T> |
IComparer<T> | comparer | The IComparer<T> to use for the sort. |
Type Parameters
Name | Description |
---|---|
T |
Sort<T>(IList<T>)
If the underlying type is List<T>, calls Sort(). If not, uses TimSort<T>(IList<T>)
Declaration
public static void Sort<T>(this IList<T> list)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | this IList<T> |
Type Parameters
Name | Description |
---|---|
T |
Sort<T>(IList<T>, IComparer<T>)
If the underlying type is List<T>, calls Sort(IComparer<T>). If not, uses TimSort<T>(IList<T>, IComparer<T>)
Declaration
public static void Sort<T>(this IList<T> list, IComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | this IList<T> |
IComparer<T> | comparer | the comparer to use for the sort |
Type Parameters
Name | Description |
---|---|
T |
Sort<T>(IList<T>, Comparison<T>)
If the underlying type is List<T>, calls Sort(IComparer<T>). If not, uses TimSort<T>(IList<T>, IComparer<T>)
Declaration
public static void Sort<T>(this IList<T> list, Comparison<T> comparison)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | this IList<T> |
Comparison<T> | comparison | the comparison function to use for the sort |
Type Parameters
Name | Description |
---|---|
T |
TimSort<T>(IList<T>)
Sorts the given IList<T> using the IComparer<T>. This method uses the Tim sort algorithm, but falls back to binary sort for small lists.
Declaration
public static void TimSort<T>(this IList<T> list)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | this IList<T> |
Type Parameters
Name | Description |
---|---|
T |
TimSort<T>(IList<T>, IComparer<T>)
Sorts the given IList<T> using the IComparer<T>. This method uses the Tim sort algorithm, but falls back to binary sort for small lists.
Declaration
public static void TimSort<T>(this IList<T> list, IComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | this IList<T> |
IComparer<T> | comparer | The IComparer<T> to use for the sort. |
Type Parameters
Name | Description |
---|---|
T |