Show / Hide Table of Contents

    Class ListExtensions

    Inheritance
    System.Object
    ListExtensions
    Namespace: Lucene.Net.Support
    Assembly: Lucene.Net.dll
    Syntax
    public static class ListExtensions : object

    Methods

    | Improve this Doc View Source

    AddRange<T>(IList<T>, IEnumerable<T>)

    Declaration
    public static void AddRange<T>(this IList<T> list, IEnumerable<T> values)
    Parameters
    Type Name Description
    IList<T> list
    IEnumerable<T> values
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    BinarySearch<T>(IList<T>, T)

    Performs a binary search for the specified element in the specified sorted list. The list needs to be already sorted in natural sorting order. Searching in an unsorted array has an undefined result. It's also undefined which element is found if there are multiple occurrences of the same element.

    Declaration
    public static int BinarySearch<T>(this IList<T> list, T item)
        where T : IComparable<T>
    Parameters
    Type Name Description
    IList<T> list

    The sorted list to search.

    T item

    The element to find.

    Returns
    Type Description
    System.Int32

    The non-negative index of the element, or a negative index which is the -index - 1 where the element would be inserted.

    Type Parameters
    Name Description
    T

    The element type.

    | Improve this Doc View Source

    BinarySearch<T>(IList<T>, T, IComparer<T>)

    Performs a binary search for the specified element in the specified sorted list using the specified comparator. The list needs to be already sorted according to the comparer passed. Searching in an unsorted array has an undefined result. It's also undefined which element is found if there are multiple occurrences of the same element.

    Declaration
    public static int BinarySearch<T>(this IList<T> list, T item, IComparer<T> comparer)
        where T : IComparable<T>
    Parameters
    Type Name Description
    IList<T> list

    The sorted to search.

    T item

    The element to find.

    IComparer<T> comparer

    The comparer. If the comparer is null then the search uses the objects' natural ordering.

    Returns
    Type Description
    System.Int32

    the non-negative index of the element, or a negative index which is the -index - 1 where the element would be inserted.

    Type Parameters
    Name Description
    T

    The element type.

    | Improve this Doc View Source

    IntroSort<T>(IList<T>)

    Sorts the given using the . 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

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    IntroSort<T>(IList<T>, IComparer<T>)

    Sorts the given using the . 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

    IComparer<T> comparer

    The to use for the sort.

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Shuffle<T>(IList<T>)

    Shuffles an in place using a new instance.

    Declaration
    public static void Shuffle<T>(this IList<T> list)
    Parameters
    Type Name Description
    IList<T> list

    This .

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Shuffle<T>(IList<T>, Random)

    Shuffles an in place using the specified random instance.

    Declaration
    public static void Shuffle<T>(this IList<T> list, Random random)
    Parameters
    Type Name Description
    IList<T> list

    This .

    Random random
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Sort<T>(IList<T>)

    If the underlying type is , calls . 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

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Sort<T>(IList<T>, Comparison<T>)

    If the underlying type is , calls . 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

    Comparison<T> comparison

    the comparison function to use for the sort

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Sort<T>(IList<T>, IComparer<T>)

    If the underlying type is , calls . 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

    IComparer<T> comparer

    the comparer to use for the sort

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    SubList<T>(IList<T>, Int32, Int32)

    Declaration
    public static IList<T> SubList<T>(this IList<T> list, int fromIndex, int toIndex)
    Parameters
    Type Name Description
    IList<T> list
    System.Int32 fromIndex
    System.Int32 toIndex
    Returns
    Type Description
    IList<T>
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Swap<T>(IList<T>, Int32, Int32)

    Declaration
    public static void Swap<T>(this IList<T> list, int indexA, int indexB)
    Parameters
    Type Name Description
    IList<T> list
    System.Int32 indexA
    System.Int32 indexB
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    TimSort<T>(IList<T>)

    Sorts the given using the . 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

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    TimSort<T>(IList<T>, IComparer<T>)

    Sorts the given using the . 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

    IComparer<T> comparer

    The to use for the sort.

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