Class ListExtensions
Extensions to System.Collections.Generic.IList<T>.
Inheritance
Inherited Members
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public static class ListExtensions
Methods
| Improve this Doc View SourceAddRange<T>(IList<T>, IEnumerable<T>)
Adds the elements of the specified collection to the end of the System.Collections.Generic.IList<T>.
Declaration
public static void AddRange<T>(this IList<T> list, IEnumerable<T> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T> | list | The list to add to. |
System.Collections.Generic.IEnumerable<T> | collection | The collection whose elements should be added to the end of the System.Collections.Generic.IList<T>.
The collection itself cannot be |
Type Parameters
Name | Description |
---|---|
T | The element type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
IntroSort<T>(IList<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>(this 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>(this IList<T> list, IComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T> | list | this System.Collections.Generic.IList<T> |
System.Collections.Generic.IComparer<T> | comparer | The System.Collections.Generic.IComparer<T> to use for the sort. |
Type Parameters
Name | Description |
---|---|
T |
Sort<T>(IList<T>)
If the underlying type is System.Collections.Generic.List<T>, calls System.Collections.Generic.List`1.Sort. If not, uses TimSort<T>(IList<T>)
Declaration
public static void Sort<T>(this IList<T> list)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T> | list | this System.Collections.Generic.IList<T> |
Type Parameters
Name | Description |
---|---|
T |
Sort<T>(IList<T>, IComparer<T>)
If the underlying type is System.Collections.Generic.List<T>, calls System.Collections.Generic.List`1.Sort(System.Collections.Generic.IComparer{`0}). 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 |
---|---|---|
System.Collections.Generic.IList<T> | list | this System.Collections.Generic.IList<T> |
System.Collections.Generic.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 System.Collections.Generic.List<T>, calls System.Collections.Generic.List`1.Sort(System.Collections.Generic.IComparer{`0}). 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 |
---|---|---|
System.Collections.Generic.IList<T> | list | this System.Collections.Generic.IList<T> |
System.Comparison<T> | comparison | the comparison function to use for the sort |
Type Parameters
Name | Description |
---|---|
T |
TimSort<T>(IList<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>(this 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>(this IList<T> list, IComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T> | list | this System.Collections.Generic.IList<T> |
System.Collections.Generic.IComparer<T> | comparer | The System.Collections.Generic.IComparer<T> to use for the sort. |
Type Parameters
Name | Description |
---|---|
T |