Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public static class WordMap
  2. extends Mapper<Object, Text, Text, IntWritable>{
  3.  
  4. private final static IntWritable one = new IntWritable(1);
  5. private Text word = new Text();
  6.  
  7. public void map(Object key, Text value, Context context
  8. ) throws IOException, InterruptedException {
  9. StringTokenizer itr = new StringTokenizer(value.toString());
  10. while (itr.hasMoreTokens()) {
  11. word.set(itr.nextToken());
  12. context.write(word, one);
  13. }
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement