We will now present a MapReduce example using both the old and new MapReduce APIs.
We will now write a MapReduce program in Java that finds all the anagrams (a word, phrase, or name formed by rearranging the letters of another, such as cinema, formed from iceman) presents them in an input file, and finally prints all the anagrams in the output file.
Here is the AnagramMapperOldAPI.java
class that uses the old MapReduce API:
import java.io.IOException; import java.util.Arrays; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.MapReduceBase; import org.apache.hadoop.mapred.Mapper; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reporter; import java.util.StringTokenizer; /** * The Anagram mapper class gets a word as a line from the HDFS input and sorts the * letters in the word and writes its back to the output collector as * Key : sorted word (letters in the word sorted) * Value: the word itself as...