nTabela de
frequencia de palavras
npublic
class Freq {
n private static final Integer ONE = new Integer(1);
n public static void main(String args[]) {
n Map<String,
Integer> m = new HashMap<String, Integer>();
n // Initialize frequency table from
command line
n for (int i=0; i < args.length; i++) {
n Integer freq =
(Integer)m.get(args[i]);
n m.put(args[i], (freq==null ? ONE : new Integer(freq.intValue() + 1)));
n }
n System.out.println(m.size()+ "
palavras distintas encontradas:");
n System.out.println(m);
n }
n}