KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > nutch > mapReduce > DefaultReducer


1 /* Copyright (c) 2005 The Nutch Organization. All rights reserved. */
2 /* Use subject to the conditions in http://www.nutch.org/LICENSE.txt. */
3
4 package net.nutch.mapReduce;
5
6 import java.io.IOException JavaDoc;
7
8 import java.util.Iterator JavaDoc;
9
10 import net.nutch.io.Writable;
11 import net.nutch.io.WritableComparable;
12
13 /** The default {@link Reducer}. Performs no reduction, writing all input
14  * values directly to the output. */

15 public class DefaultReducer implements Reducer {
16
17   /** Writes all values directly to results. */
18   public void reduce (WritableComparable key, Iterator JavaDoc values,
19                       OutputCollector results) throws IOException JavaDoc {
20     while (values.hasNext()) {
21       results.collect(key, (Writable)values.next());
22     }
23   }
24
25 }
26
Popular Tags