ListUtilities<T> extension

/// Extends List with additional basic methods.

on

Methods

count(T object) int

Available on List<T>, provided by the ListUtilities extension

Returns the number of instances there are of object in this list.
exclude(Iterable<T> subset) List<T>

Available on List<T>, provided by the ListUtilities extension

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>

Available on List<T>, provided by the ListUtilities extension

Returns a sublist containing every element in this list, excluding those at the defined indexes.
getRandom(int count, [int? seed]) List<T>

Available on List<T>, provided by the ListUtilities extension

Returns a new list containing random elements from this list.
pluck(int start, int? end) List<T>

Available on List<T>, provided by the ListUtilities extension

Removes and returns a range of elements from this list.
removeFirst() → T

Available on List<T>, provided by the ListUtilities extension

Removes the first element in this list.
removeFirstWhere(ListTester<T> test) bool

Available on List<T>, provided by the ListUtilities extension

Removes the first element in this list that satisfies test.
removeFrom(int index, int count) → void

Available on List<T>, provided by the ListUtilities extension

Removes the number of elements defined by count, starting from index.
removeFromEnd(int count) → void

Available on List<T>, provided by the ListUtilities extension

Removes the number of elements defined by count from the end of the list.
removeLastWhere(ListTester<T> test) bool

Available on List<T>, provided by the ListUtilities extension

Removes the last element in this list that satisfies test.
removeNull() → void

Available on List<T>, provided by the ListUtilities extension

Removes all null values from this list.
removeRandom([int? seed]) → T

Available on List<T>, provided by the ListUtilities extension

Removes and returns a random value from this list.
resizeAndFill(int resizeBy, T fill) → void

Available on List<T>, provided by the ListUtilities extension

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

Available on List<T>, provided by the ListUtilities extension

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

Available on List<T>, provided by the ListUtilities extension

Updates the element at index to the value returned by transformer.
transformAll(ListTransformer<T> transformer) → void

Available on List<T>, provided by the ListUtilities extension

Updates every element in the list to the value returned by transformer.