fold
Run through all elements from left to right and apply operation on each one in order.
Each operation is passed in an accumulated value which it can modify. The method ultimately returns the result returned from the last operation.
Note: This is identical to Android's foldIn
method. However, we are calling it simply fold
for now, as we don't currently have a need for foldOut
, as this codebase (and the web approach in general?) doesn't yet have a need for the other direction, and fold
is more consistent with Iterable.fold.