I am trying to code to read info from a text file, I need to find out how many times each word separated by white space occurs. I then need to output in alphabetical order with the count of each word. I am looking to use a TreeMap, keySet() and an Iterator. My code is very incomplete and I am quite stuck.
import java.util.HashMap;
import java.util.Map
public class WordCount<E extends Comparable<E>> {
private static Map<String, Integer> map = new HashMap<String, Integer>();
static {
fillMap(map, "Alice.txt");
}
private static void fillMap(Map<String, Integer> map, String fileName) {
}
}