ListUtilities<T> extension

/// Extends List with additional basic methods.

on

Methods

count(T object) int
Returns the number of instances there are of object in this list.
exclude(Iterable<T> subset) List<T>
Returns a new list containing all of the elements in this list that aren't also contained within subset.
excludeByIndex(Iterable<int> indexes) List<T>
Returns a sublist containing every element in this list, excluding those at the defined indexes.
getRandom(int count, [int? seed]) List<T>
Returns a new list containing random elements from this list.
pluck(int start, int? end) List<T>
Removes and returns a range of elements from this list.
removeFirst() → T
Removes the first element in this list.
removeFirstWhere(ListTester<T> test) bool
Removes the first element in this list that satisfies test.
removeFrom(int index, int count) → void
Removes the number of elements defined by count, starting from index.
removeFromEnd(int count) → void
Removes the number of elements defined by count from the end of the list.
removeLastWhere(ListTester<T> test) bool
Removes the last element in this list that satisfies test.
removeNull() → void
Removes all null values from this list.
removeRandom([int? seed]) → T
Removes and returns a random value from this list.
resizeAndFill(int resizeBy, T fill) → void
Resizes the list by resizeBy, setting the new elements to fill if resizeBy is positive, otherwise removing elements if resizeBy is negative.
resizeAndGenerate(int resizeBy, ListGenerator<T> generator) → void
Resizes the list by resizeBy, setting the new elements with the generator if resizeBy is positive, otherwise removing elements if resizeBy is negative.
transform(int index, ListTransformer<T> transformer) → void
Updates the element at index to the value returned by transformer.
transformAll(ListTransformer<T> transformer) → void
Updates every element in the list to the value returned by transformer.