ListExtension<T> extension

extension for List<T>.

on

Properties

lastIndex int
The last index of this List.
no setter

Methods

allEquals(T element) bool
Returns true if all elements are equals to element.
asDoubles() List<double>
Returns this instance as a List
asInts() List<int>
Returns this instance as a List
binarySearchPoint(T key, {int start = 0, int? end, Comparator<T>? compare}) int
A binary search that returns:
computeHashcode() int
Computes the hashcode of this List, using ListEquality defaults.
ensureMaximumSize(int maximumSize, {bool removeFromEnd = false, int removeExtras = 0}) int
Ensures that this List.length is not bigger than maximumSize.
equalsElements(List<T> other) bool
Returns true if all the elements are equals to other elements.
getReversed(int reversedIndex) → T
Returns the elements at reversedIndex (index: [lastIndex - reversedIndex]).
getValueIfExists(int index) → T?
Returns the element at index. Returns null if out of range.
Head of this List with size.
headByRatio(double sizeRatio, {int? minimumSize}) List<T>
Head of this List with size based the in sizeRatio of length. See lengthRatio.
lengthRatio(double ratio, {int? minimumSize}) int
Returns the length multiplied by ratio.
randomSelection({int? length, double? lengthRatio, int? minimumSize, Random? random, int? seed}) List<T>
removeAll(Iterable other) → void
Remove from this List all the elements contained in other.
removeFromBegin(int amount) int
Remove an amount of elements from the beginning.
removeFromEnd(int amount) int
Remove an amount of elements from the end.
resampleByIndex<R>(RangeSelectorFunction<T, RangeSelectionByIndex<T>> selector, List<R> merger(List<T> sel), {bool skipResampledIndexes = true}) List<R>
Resample elements by index range (RangeSelectionByIndex).
resampleByValue<R>(RangeSelectorFunction<T, RangeSelectionByValue<T>> selector, List<R> merger(List<T> sel), {bool skipResampledIndexes = true, Comparator<T>? compare}) List<R>
Resample elements by value range (RangeSelectionByValue).
retainAll(Iterable other) → void
Retain in this List all the elements contained in other.
searchInsertSortedIndex<E, K>(T key, {int start = 0, int? end, Comparator<T>? compare}) int
Returns the index to insert key and keep the List sorted.
setAllWith(T f(int index, T value)) int
Set all elements of this instance with values from f.
setAllWithList(List<T> list, [int offset = 0]) int
Set all elements of this instance with list, starting from list offset.
setAllWithValue(T value) int
Set all elements of this instance with value.
shuffleCopy({Random? random, int? seed}) List<T>
sublistReversed(int endReversed, [int? startReversed]) List<T>
Sames as sublist, but with reversed parameters indexes endReversed and startReversed.
tail(int size) List<T>
Tail of this List with size.
tailByRatio(double sizeRatio, {int? minimumSize}) List<T>
Tail of this List with size based the in sizeRatio of length. See lengthRatio.
toDistinctList() List<T>
Converts to a list of distinct elements. Same as toSet().toList() but in a optimized way for small sets.
toStringElements() List<String>
Creates a new List<String>, mapping each element to a String.