Class ClassicReducer<V,R>

java.lang.Object
mapreduce.apps.reducer.classic.exercise.ClassicReducer<V,R>
Type Parameters:
V - the type of value being reduced
R - the result of the reduction
All Implemented Interfaces:
AccumulatorCombinerReducer<V,List<V>,R>
Direct Known Subclasses:
ChessReducer, MutualFriendsClassicReducer, SummingIntClassicReducer, TrueCountClassicReducer, TruePortionClassicReducer

public abstract class ClassicReducer<V,R> extends Object implements AccumulatorCombinerReducer<V,List<V>,R>
An interface used for Collectors that are similar to Hadoop's reducer. In Hadoop, the collecting of the values into one place is done for you, and you are given an Iterable of the values. Java's Collector works a bit differently because it can have any type as its mutable result container. In other words, Java's Collector is more general, because you don't have to store the values in a list. In this interface, we're making it easier to use Java's Collector like a Hadoop reducer.

Java's Collector interface has four methods: Collector.supplier(), Collector.accumulator(), Collector.combiner(), and Collector.finisher(). This interface defines three of those methods.

This interface is built around the list as the mutable result container. The supplier's get method creates a new list, the accumulator's accept method adds an item to the list, and the combiner's apply method combines two lists. The last method, finisher, must be defined by any class implementing this interface. It finishes the reduction by converting everything in the list into some result type.

Author:
__STUDENT_NAME__, Finn Voichick, Dennis Cosgrove