'Treemap'에 해당되는 글 1건

  1. 2007.01.23 [sample] treeMap 사용법 1
import java.util.*;

public class Freq {
     private static final Integer ONE = new Integer(1);
     public static void main(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);
    }
}
1 

글 보관함

카운터

Total : / Today : / Yesterday :
get rsstistory!