CollectionOps<T> extension

on

Properties

headOption → T?

Available on Iterable<T>, provided by the CollectionOps extension

safely access first element of list that may be empty.
no setter
lastOption → T?

Available on Iterable<T>, provided by the CollectionOps extension

safely access last element of list that may be empty.
no setter
zipWithIndex Iterable<$<T, int>>

Available on Iterable<T>, provided by the CollectionOps extension

zip values with index
no setter

Methods

chunk(int n) Iterable<Iterable<T>>

Available on Iterable<T>, provided by the CollectionOps extension

returns a list of list of length up to n. example
count(bool f(T)) int

Available on Iterable<T>, provided by the CollectionOps extension

count up elements applying function f returns true.
groupBy<S>(S f(T)) Map<S, Iterable<T>>

Available on Iterable<T>, provided by the CollectionOps extension

returns Map<S,Iterable
interspace<R extends T>(R r) Iterable<T>

Available on Iterable<T>, provided by the CollectionOps extension

insert value between each element
slice(int from, [int? to]) Iterable<T>

Available on Iterable<T>, provided by the CollectionOps extension

return sublist of range [from,to)
slide() Iterable<$<T, T>>

Available on Iterable<T>, provided by the CollectionOps extension

returns a list of pairs of values slided by 1. example
sliding(int n) Iterable<Iterable<T>>

Available on Iterable<T>, provided by the CollectionOps extension

/// returns a list of pairs of values slided by n. example
sorted([int f(T, T)?]) Iterable<T>

Available on Iterable<T>, provided by the CollectionOps extension

returns new sorted iterable.
splitAt(int n) $<Iterable<T>, Iterable<T>>

Available on Iterable<T>, provided by the CollectionOps extension

zip<S>(Iterable<S> t) List<$<T, S>>

Available on Iterable<T>, provided by the CollectionOps extension

zip corresponding values with values from another iterable. If one iterable is shorter than the other, it generates iterable of shorter length.