] >
Write a program Dict.java that prints an Indian Alaska to English dictionary, by inversing the English to Indian Alaskan dictionary available at http://www.gutenberg.org/files/10040/10040.txt.
Notes.
Suggestion. Build your program incrementally in the following manner.
Upon completion of reading the input file, extract the keys from hash map with a command similar to
String [] key = dict.keySet().toArray(new String[0])
and print the array. (The variable ‘dict’ is assumed to hold the hash table created in the previous step.)
Print with each key its corresponding value from the hash map. The trailing portion of the out should be similar to the following segment.
Problems.
In old versions of Java, use constructs of the forms
HashMap dic = new HashMap()
String [] key = (String []) dict.keySet().toArray(new String[0])
instead of constructs of the following forms.
HashMap<String, String> dic = new HashMap<String, String>()
String [] key = dict.keySet().toArray(new String[0])