public class TestMap3 { public static void main(String[] args) { int i; Integer freq; String s; Map M = new Map(); /* ------------------------------------------------------- Enter arg strings into the Map along with frequency ------------------------------------------------------- */ for (i = 0; i < args.length; i++) { s = args[i]; freq = M.get(s); if ( freq == null ) { M.put(s, 1); } else { M.put(s, freq.intValue() + 1); } System.out.println("After processing `" + args[i] + "':"); System.out.println(M); System.out.println(); } System.out.println("========================="); System.out.println(M.size() + " distinct words:"); System.out.println(M); } }