CollectionOps<T> extension

on

Properties

headOption → T?
safely access first element of list that may be empty.
no setter
lastOption → T?
safely access last element of list that may be empty.
no setter
zipWithIndex Iterable<$<T, int>>
zip values with index
no setter

Methods

chunk(int n) Iterable<Iterable<T>>
returns a list of list of length up to n. example
count(bool f(T)) int
count up elements applying function f returns true.
groupBy<S>(S f(T)) Map<S, Iterable<T>>
returns Map<S,Iterable
interspace<R extends T>(R r) Iterable<T>
insert value between each element
slice(int from, [int? to]) Iterable<T>
return sublist of range [from,to)
slide() Iterable<$<T, T>>
returns a list of pairs of values slided by 1. example
sliding(int n) Iterable<Iterable<T>>
/// returns a list of pairs of values slided by n. example
sorted([int f(T, T)?]) Iterable<T>
returns new sorted iterable.
splitAt(int n) $<Iterable<T>, Iterable<T>>
zip<S>(Iterable<S> t) List<$<T, S>>
zip corresponding values with values from another iterable. If one iterable is shorter than the other, it generates iterable of shorter length.