FileDocCategorySizeDatePackage
Freq.javaAPI DocExample556Tue Dec 12 18:59:42 GMT 2000None

Freq

public class Freq extends Object

Fields Summary
private static final Integer
ONE
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)


         
        Map m = new TreeMap();

        // Initialize frequency table from command line
        for (int i=0; i<args.length; i++) {
            Integer freq = (Integer) m.get(args[i]);
            m.put(args[i], (freq==null ? ONE :
                            new Integer(freq.intValue() + 1)));
        }

        System.out.println(m.size() + " distinct words detected:");
        System.out.println(m);