TreeMap Class



public static void main(String[] args){
   TreeMap<String, String> test = new TreeMap();
    test.put("A","1" );
    test.put("a","1" );
    test.put("가","1" );
    test.put("b","1" );
    test.put("c","1" );
    test.put("1","1" );
    test.put("9","1" );

    System.out.println(test.entrySet()); //
    System.out.println("------------------------------");

    Set<Entry<String, String>> Ttest = test.entrySet();
    for(Entry tmp : Ttest){
             System.out.print(","+tmp.getKey()+" = "+tmp.getValue()+"\t"); // 키와 값 확인
    }//for
    System.out.println();
 
    System.out.println("------------------------------");
    System.out.println(test.firstKey()); // 맨 앞에 키
    System.out.println(test.lastKey());  // 맨 뒤의 키
    System.out.println(test.lowerKey("a")); // a 보다 낮은 키
    System.out.println(test.higherKey("9")); // 9 보다 높은키
}
-------------------------------------------------------------------------------
 // 저장하면서 키를 정렬하는 TreeMap 클래스
 // TreeMap의 기본순서 정렬 : 숫자>알바벳 대문자>알파벳 소문자>한글

result :
[1=1, 9=1, A=1, a=1, b=1, c=1, 가=1]
---------------
,1 = 1 ,9 = 1 ,A = 1,a = 1 ,b = 1 ,c = 1 ,가 = 1
---------------
1

A
A

Popular posts from this blog

youtube download

com.gpki.secureweb.GPKISecureWEBException: ErrCode=1507,ErrMsg=[GPKI_CMS_ProcessEnvelopedData] 해당 인증서로는 데이터를 풀 수 없습니다.

rexpert 공식필드(javascript) 점검일 주기 계산