diff options
Diffstat (limited to 'chapter')
| -rw-r--r-- | chapter/8/big-data.md | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/chapter/8/big-data.md b/chapter/8/big-data.md index 915325e..2df67a3 100644 --- a/chapter/8/big-data.md +++ b/chapter/8/big-data.md @@ -85,26 +85,23 @@ import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; public class WordCount { - public static class Map extends - Mapper<LongWritable, Text, Text, IntWritable> + public static class Map extends Mapper<LongWritable, Text, Text, IntWritable> { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); - public void map(LongWritable key, Text value, Context context) - throws IOException, InterruptedException + public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.hasMoreTokens()) { - word.set(tokenizer.nextToken()); - context.write(word, one); + word.set(tokenizer.nextToken()); + context.write(word, one); } } - public static class Reduce - extends Reducer<Text, IntWritable, Text, IntWritable> + public static class Reduce extends Reducer<Text, IntWritable, Text, IntWritable> { public void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException { |
