C
- the result - largest comparable in the aggregated collectionT
- the type of the collection being aggregatedpublic class MaxAggregator<C extends Comparable,T> extends Object implements Aggregator<Map.Entry<T,C>,T>
Constructor and Description |
---|
MaxAggregator(Handler<C,T> comparifier) |
public void init(Collection<T> elements)
init
in interface Aggregator<Map.Entry<T,C extends Comparable>,T>
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.public void aggregate(T element)
aggregate
in interface Aggregator<Map.Entry<T,C extends Comparable>,T>
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;public Map.Entry<T,C> finish()
finish
in interface Aggregator<Map.Entry<T,C extends Comparable>,T>
Copyright © 2004-2016. All Rights Reserved.