Applies the combinator
function to all elements of the iterator in turn and uses
seed as the
start value.
One of the function parameters is an element of the iterator, and the other is the result of previous application
of the function. The seed of the operation is explicitly passed to
#fold(Iterator,Object,org.eclipse.xtext.xbase.lib.Functions.Function2). The first computed value is the result of the applied function for
seed and the first element of
the iterator. This intermediate result together with the second element of the iterator produced the next result
and so on.
#fold(Iterator,Object,org.eclipse.xtext.xbase.lib.Functions.Function2) is similar to
#reduce(Iterator,org.eclipse.xtext.xbase.lib.Functions.Function2) but
allows a
seed value and the combinator
function may be asymmetric. It takes
T and R and
returns
R.
If the iterator is empty, seed
is returned.
More formally, given an iterator
[a, b, c, d], a seed
initial and a function
f, the
result of
fold is f(f(f(f(initial, a), b), c), d)