Iterable_<T> extension

Supercharged extensions on Iterables like List and Set.

on

Properties

lastIndex int
Returns the last accessible index. If collection is empty this returns null. [...]
read-only

Methods

associate<K, V>(MapEntry<K, V> transform(T element)) Map<K, V>
Returns a map that contains MapEntrys provided by a transform function. [...]
associateBy<K>(K keySelector(T element)) Map<K, T>
Returns a map where every element is associated by a key produced from the keySelector function. [...]
associateWith<V>(V valueSelector(T element)) Map<T, V>
Returns a map where every element is used as a key that is associated with a value produced by the valueSelector function. [...]
averageBy(num selector(T)) double
Returns the average value (arithmetic mean) of all values produces by the selector function that is applied to each element. [...]
chunked(int size, {T fill()}) Iterable<List<T>>
Splits the elements into lists of the specified size. [...]
count([bool test(T element)]) int
Returns the number of elements that matches the test. [...]
elementAtOrElse(int index, T orElse()) → T
Returns the indexth element. If the index is out of bounds the orElse supplier function is called to provide a value. [...]
elementAtOrNull(int index) → T
Returns the indexth element. If the index is out of bounds it will return null. [...]
filter(bool test(T element)) Iterable<T>
Returns a new Iterable with all elements that satisfy the predicate test. [...]
firstOrElse(T orElse()) → T
Returns the first element. If there is no first element the orElse supplier function is called to provide a value. [...]
firstOrNull() → T
Returns the first element. If there is no first element it will return null. [...]
forEachIndexed(void funcIndexValue(int index, T element)) → void
Applies the function funcIndexValue to each element of this collection in iteration order. The function receives the element index as first parameter index and the element as the second parameter. [...]
groupBy<K, V>(K keySelector(T element), {V valueTransform(T element)}) Map<K, List<V>>
Groups the elements of the list into a map by a key that is defined by a keySelector function. [...]
lastOrElse(T orElse()) → T
Returns the last element. If there is no last element the orElse supplier function is called to provide a value. [...]
lastOrNull() → T
Returns the last element. If there is no last element it will return null. [...]
maxBy(Comparator<T> comparator) → T
Returns the maximum value based on the comparator function. [...]
minBy(Comparator<T> comparator) → T
Returns the minimal value based on the comparator function. [...]
sortedBy(Comparator<T> comparator) List<T>
Returns this as sorted list using the comparator function. [...]
sortedByNum(num valueProvider(T element)) List<T>
Returns this as sorted list using the valueProvider function that produces numerical values as base for sorting. [...]
sortedByString(String valueProvider(T element)) List<T>
Returns this as sorted list using the valueProvider function that produces character values as base for sorting. [...]
sumBy(int selector(T)) int
Returns the sum of all values produced by the selector function that is applied to each element. [...]
sumByDouble(num selector(T)) double
Returns the sum of all values produced by the selector function that is applied to each element. [...]
withoutFirst() Iterable<T>
Lazily returns all values without the first one. [...]
withoutLast() Iterable<T>
Lazily returns all values without the last one. [...]