R
- the aggregation resultT
- the aggregated collection typepublic interface Aggregator<R,T>
void init(Collection<T> elements)
elements
- the container that's about to be iterated.
use this function to initialize the aggregation process. for example, you might need to create
a "result" collection and you can set it's size according to elements.size() for performance reasons.void aggregate(T element)
element
- the currently iterated element that you should add to the aggregation.
if the aggregator implementation is to create a sum of integers, then an implementation for this
method would be sum += element;R finish()
Copyright © 2004-2016. All Rights Reserved.