title: map reduce word count example doesn't work
body: <p>I try to implement the word count example by myself, here's my implementation of the mapper:</p>
  
  <pre><code>public static class Map extends Mapper&lt;LongWritable, Text, Text, IntWritable&gt; {
  
      public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
          Text word = new Text();     
          String line = value.toString();
          StringTokenizer tokenizer = new StringTokenizer(line);
          while (tokenizer.hasMoreTokens()) {
              word.set(tokenizer.nextToken());
              context.write(word, new IntWritable(1));
          }
      }
  }
  </code></pre>
  
  <p>and reducer:</p>
  
  <pre><code>public static class Reduce extends Reducer&lt;Text, IntWritable, Text, IntWritable&gt; {
      public void reduce(Text key, Iterator&lt;IntWritable&gt; values, Context context) throws IOException, InterruptedException {
          int sum = 0;
          while (values.hasNext())
              sum += values.next().get();
      context.write(key, new IntWritable(sum));
      }
  }
  </code></pre>
  
  <p>but the output I get for executing this code looks like the output of mapper only, for example, if the input is "hello world hello", the output would be</p>
  
  <pre><code>hello 1
  hello 1
  world 1
  </code></pre>
  
  <p>I also use combiner between mapping and reducing. Can anyone explain me what's wrong with this code?</p>
  
  <p>Thanks a lot!</p>