Itertools<T> extension

on

Properties

firstOrNull → T?
Returns the first or null when the collection is empty
no setter
lastOrNull → T?
Returns the last or null when the collection is empty
no setter

Methods

compress(Iterable<bool> selectors) Iterable<T>
Make an iterator that filters elements from data returning only those that have a corresponding element in selectors that evaluates to True.
concat(Iterable<T> iterable) Iterable<T>
concat this and iterable
cycle() Iterable<T>
Make an iterator returning elements from the iterable and saving a copy of each. When the iterable is exhausted, return elements from the saved copy. Repeats indefinitely.
enumerate({int start = 0}) Iterable<Tuple2<int, T>>
mapIndexed<E>(E f(int index, T item)) Iterable<E>
Returns a new lazy Iterable with elements that are created by calling f on each element of this Iterable in iteration order.
mapList<E>(E toElement(T item), {bool growable = true}) List<E>
The elements of this iterable are modified by toElement and converted iterable to list
maxBy(Comparator<T> comparable, {T orElse()?}) → T
return max by comparable
minBy(Comparator<T> comparable, {T orElse()?}) → T
return min by comparable
sorted({bool growable = true}) List<T>
Returns a new list with all elements sorted according to natural sort order.
sortedBy(Comparator<T> compare, {bool growable = true}) List<T>
Returns a new list with all elements sorted according to the order specified by the compare function.