Extension methods and helper methods for List{T}, IList{T}, IReadOnlyList{T}, arrays, IListSource{T}, and for related mutable interfaces such as IArray{T}.
More...
Extension methods and helper methods for List{T}, IList{T}, IReadOnlyList{T}, arrays, IListSource{T}, and for related mutable interfaces such as IArray{T}.
Extension methods that only apply to Loyc's new interfaces, or adapt a list to those interfaces, will go in LCExt instead.
The source code for adapter extension methods such as the Slice() method for arrays, which returns an ArraySlice{T} adapter, is now placed in the source file for each adapter class (e.g. ArraySlice.cs) to make it easier to create custom versions of Loyc.Essentials with parts removed.
|
static ArraySlice< T > | Slice< T > (this T[] list, int start, int length=int.MaxValue) |
|
static ReversedList< T > | Reverse< T > (this IList< T > list) |
| Returns an editable reversed view of a list. More...
|
|
static ReversedList< T > | Reverse< T > (this IListAndListSource< T > list) |
| Returns a reversed view of a list. More...
|
|
static IRange< T > | AsRange< T > (this IListSource< T > list) |
|
static IRange< T > | AsRange< T > (this IRange< T > list) |
|
static int | BinarySearch< T > (this IList< T > list, T value) |
|
static int | BinarySearch< T > (this IList< T > list, T value, IComparer< T > pred) |
|
static int | BinarySearch< T > (this IList< T > list, T find, Comparison< T > compare) |
|
static int | BinarySearch2< T, K > (this IList< T > list, K find, Func< T, K, int > compare, bool lowerBound=true) |
|
static int | BinarySearch< T > (this IReadOnlyList< T > list, T value) |
|
static int | BinarySearch< T > (this IReadOnlyList< T > list, T value, IComparer< T > comparer) |
|
static int | BinarySearch< T > (this IReadOnlyList< T > list, T find, Comparison< T > compare) |
|
static int | BinarySearch2< T, K > (this IReadOnlyList< T > list, K find, Func< T, K, int > compare, bool lowerBound=true) |
|
static int | BinarySearch< T > (this IListAndListSource< T > list, T value) |
|
static int | BinarySearch< T > (this IListAndListSource< T > list, T value, IComparer< T > comparer) |
|
static int | BinarySearch< T > (this IListAndListSource< T > list, T value, Comparison< T > compare) |
|
static int | BinarySearch2< T, K > (this IListAndListSource< T > list, K value, Func< T, K, int > compare, bool lowerBound=true) |
|
static void | CopyTo< T > (this IReadOnlyCollection< T > c, T[] array, int arrayIndex) |
|
static T | TryGet< T > (this T[] list, int index, T defaultValue) |
|
static Maybe< T > | TryGet< T > (this T[] list, int index) |
|
static T | TryGet< T > (this List< T > list, int index, T defaultValue) |
|
static Maybe< T > | TryGet< T > (this List< T > list, int index) |
|
static T | TryGet< T > (this IList< T > list, int index, T defaultValue) |
|
static Maybe< T > | TryGet< T > (this IList< T > list, int index) |
|
static T | TryGet< T > (this IListAndListSource< T > list, int index, T defaultValue) |
|
static Maybe< T > | TryGet< T > (this IListAndListSource< T > list, int index) |
|
static T | TryGet< T > (this IReadOnlyList< T > list, int index, T defaultValue) |
|
static Maybe< T > | TryGet< T > (this IReadOnlyList< T > list, int index) |
|
static void | RemoveRange< T > (this IList< T > list, int index, int count) |
|
static void | Resize< T > (this List< T > list, int newSize) |
|
static void | Resize< T > (this IList< T > list, int newSize) |
|
static void | MaybeEnlarge< T > (this List< T > list, int minSize) |
|
static void | MaybeEnlarge< T > (this IList< T > list, int minSize) |
|
static IEnumerable< Pair< A, B > > | Zip< A, B > (this IEnumerable< A > a, IEnumerable< B > b) |
|
static IEnumerable< Pair< A, B > > | ZipLeft< A, B > (this IEnumerable< A > a, IEnumerable< B > b, B defaultB) |
|
static IEnumerable< C > | ZipLeft< A, B, C > (this IEnumerable< A > a, IEnumerable< B > b, B defaultB, Func< A, B, C > resultSelector) |
|
static IEnumerable< Pair< A, B > > | ZipLonger< A, B > (this IEnumerable< A > a, IEnumerable< B > b) |
|
static IEnumerable< Pair< A, B > > | ZipLonger< A, B > (this IEnumerable< A > a, IEnumerable< B > b, A defaultA, B defaultB) |
|
static IEnumerable< C > | ZipLonger< A, B, C > (this IEnumerable< A > a, IEnumerable< B > b, A defaultA, B defaultB, Func< A, B, C > resultSelector) |
|
static int[] | RangeArray (int count) |
| Returns an array of Length count containing the numbers 0 through count-1 . More...
|
|
static void | Sort< T > (this IList< T > list) |
|
static void | Sort< T > (this IList< T > list, Comparison< T > comp) |
|
static void | Sort< T > (this IList< T > list, int index, int count, Comparison< T > comp) |
| Performs a quicksort using a Comparison function. More...
|
|
static void | StableSort< T > (this IList< T > list, Comparison< T > comp) |
| Performs a stable sort, i.e. a sort that preserves the relative order of items that compare equal. More...
|
|
static void | StableSort< T > (this IList< T > list) |
|
static ListSlice< T > | SortLowestK< T > (this IList< T > list, int k) |
| Uses a partial quicksort, known as "quickselect", to find and sort the lowest k elements in a list. More...
|
|
static ListSlice< T > | SortLowestK< T > (this IList< T > list, int k, Comparison< T > comp) |
|
static ListSlice< T > | SortLowestK< T > (this IList< T > list, int index, int count, int k, Comparison< T > comp) |
|
static ListSlice< T > | SortLowestKStable< T > (this IList< T > list, int k) |
| A stable version of SortLowestK{T}(IList{T},int). This means that when k>1 and adjacent results at the beginning of list compare equal, they keep the same order that they had originally. More...
|
|
static ListSlice< T > | SortLowestKStable< T > (this IList< T > list, int k, Comparison< T > comp) |
|
static void | InsertionSort< T > (this IList< T > array, int index, int count, Comparison< T > comp) |
| Performs an insertion sort. More...
|
|
static bool | SortPair< T > (this IList< T > list, int i, int j, Comparison< T > comp) |
| Sorts two items to ensure that list[i] is less than list[j]. More...
|
|
static void | Swap< T > (this IList< T > list, int i, int j) |
| Swaps list[i] with list[j]. More...
|
|
static void | Swap< T > (this IArray< T > list, int i, int j) |
|
static int | LastIndexWhere< T > (this IList< T > list, Func< T, bool > pred) |
| Gets the highest index at which a condition is true, or -1 if nowhere. More...
|
|
static int | LastIndexWhere< T > (this IListAndListSource< T > list, Func< T, bool > pred) |
| Gets the highest index at which a condition is true, or -1 if nowhere. More...
|
|
static void | Randomize< T > (this IList< T > list) |
|
static void | Randomize< T > (this T[] list) |
|
static T[] | Randomized< T > (this IList< T > list) |
| Quickly makes a copy of a list, as an array, in random order. More...
|
|
static T[] | Randomized< T > (this IListSource< T > list) |
| Quickly makes a copy of a list, as an array, in random order. More...
|
|
static T[] | Randomized< T > (this IListAndListSource< T > list) |
| Quickly makes a copy of a list, as an array, in random order. More...
|
|
static R[] | SelectArray< T, R > (this T[] input, Func< T, R > selector) |
| Maps an array to another array of the same length. More...
|
|
static R[] | SelectArray< T, R > (this ICollection< T > input, Func< T, R > selector) |
| Maps a list to an array of the same length. More...
|
|
static R[] | SelectArray< T, R > (this IReadOnlyList< T > input, Func< T, R > selector) |
| Maps a list to an array of the same length. More...
|
|
static R[] | SelectArray< T, R > (this IListAndListSource< T > input, Func< T, R > selector) |
| Maps a list to an array of the same length. More...
|
|
static int | RemoveAll< T > (this IList< T > list, Predicate< T > match) |
| Removes the all the elements that match the conditions defined by the specified predicate. More...
|
|
static void | ReverseInPlace< T > (this IList< T > list) |
|
static void | ReverseInPlace< T > (this IArray< T > list) |
|
static void | AddRange< T > (this IList< T > list, IEnumerable< T > range) |
|
static int | InsertRange< T > (this IList< T > list, int index, IReadOnlyCollection< T > source) |
|
static int | InsertRange< T > (this IList< T > list, int index, ICollection< T > source) |
|
static int | InsertRange< T > (this IList< T > list, int index, IListAndListSource< T > source) |
|
static int | InsertRange< T > (this IList< T > list, int index, ICollectionAndReadOnly< T > source) |
|
static int | InsertRange< T > (this IList< T > list, int index, int count, IEnumerable< T > source) |
|
static void | InsertRangeHelper< T > (IList< T > list, int index, int spaceNeeded) |
| Increases the list size by spaceNeeded and copies elements starting at list[index] "rightward" to make room for inserted elements that will be initialized by the caller. More...
|
|
static bool | SequenceEqual< TSource > (this IList< TSource > first, IList< TSource > second) |
|
static bool | SequenceEqual< TSource > (this IReadOnlyCollection< TSource > first, IReadOnlyCollection< TSource > second) |
|
static bool | SequenceEqual< TSource > (this IListAndListSource< TSource > first, IListAndListSource< TSource > second) |
|
static Repeated< T > | Repeat< T > (T value, int count) |
| Returns a helper object that stores one value, but acts like a read-only list that repeats the value the specified number of times. More...
|
|
static Repeated< T > | Single< T > (T value) |
| Returns a helper object that stores one value, but acts like a read-only list of one item. More...
|
|