자바(Java)/JAVA 2SE
java.util.HashTable - Hash 처리의 발전형
본클라쓰
2009. 10. 30. 10:10
HashTable은 null 객체가 아니라면 어느 키나 값을 사용할 수 있다. HashTable은 동기화를 한다. 따라서 한명의 사용자가 사용하는 어플리케이션 제작에 사용한다.
해시 태이블 작성 코드
HashTable table = new HashTable();
table.put(one", new Integer(1) );
table.put("two", new Integer(2) );
table.put("three", new Integer(3) );
해시 테이블에 수치를 꺼내기
Integer n = (Integer) table.get("two");
if ( n != null ) {
System.out.println("two = " + n );
}