BasicIteratorMethods<T> extension

on

Properties

firstHalf Iterable<T>
no setter
lag Iterable<List<T>>
no setter
secondHalf Iterable<T>
no setter

Methods

chunks(int n) Iterable<Iterable<T>>
split iterable into chunks of size n
decimate(int n) Iterable<T>
keep n equaly spaced elements of an array
findIndices(bool test(T element)) Iterable<int>
return the indices, that satisfy the condition
nchunks(int n) Iterable<Iterable<T>>
split iterable into n chuncks of as equal size and fille the last chunk with the remaining elements
rotate([int n = 1]) Iterable<T>
takeEveryNotNth(int n) Iterable<T>
keep every other element than the nth 1,2,3,4,5,6,7,8,9.takeEveryNth(3) -> 2,3,5,6,8,9
takeEveryNth(int n) Iterable<T>
keep every nth element of an iterable starting with the first 1,2,3,4,5,6,7,8,9.takeEveryNth(3) -> 1,4,7