Package mapreduce.apps.intsum.studio
Class IntSumClassicReducer
java.lang.Object
mapreduce.apps.intsum.studio.IntSumClassicReducer
- All Implemented Interfaces:
Collector<Integer,List<Integer>,Integer>,ClassicReducer<Integer,Integer>
A reducer that sums all of the Integers passed to it. This is used in the
word count example to sum all of the ones passed to it.
Note that this class implements
ClassicReducer. This means that it is
a Collector, and the other Collector methods are defined in
the ClassicReducer interface.- Author:
- __STUDENT_NAME__, Finn Voichick, Dennis Cosgrove (http://www.cse.wustl.edu/~cosgroved/)
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.stream.Collector
Collector.Characteristics -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface mapreduce.collector.studio.ClassicReducer
accumulator, characteristics, combiner, supplier
-
Constructor Details
-
IntSumClassicReducer
public IntSumClassicReducer()
-
-
Method Details
-
finisher
Returns aFunctionused to convert from aListofIntegers to a singleInteger. This function should, given a list of integers, return their sum. Note the interesting structure of this method. It is returning an anonymous class that implements theFunctioninterface. TheFunctioninterface has aFunction.apply(Object)method, which our anonymous inner class must implement. We're giving you this structure, and you just have to implement theapplymethod.
-