The reducer
Sunday, February 28, 2010
8:49 PM
The reducer: 
Accepts <w, 1> pairs. 
Sums up the 1's. 
public void reduce(Text key, Iterator<IntWritable> values,
  OutputCollector<Text,IntWritable> output, Reporter reporter) throws IOException {
    int sum = 0;
    while (values.hasNext()) {
        IntWritable value = (IntWritable) values.next();
        sum += value.get(); // process value
    }
    output.collect(key, new IntWritable(sum));
  }
}