import java.util.*;
class Ex107_HashMap
{
public static void main(String[] args)
{
//Ex107_HashMap.java
// - HashTable, HashSet, HashMap, Dictionary
m3();
}//end main
public static void m1() {
HashMap< String,String> list = new HashMap< String,String>();
//HashMap< key의 자료형, value의 자료형>
//데이터 삽입
list.put("apple", "사과"); //put(key,value)
list.put("dog", "강아지");
list.put("cat", "고양이");
list.put("java", "자바");
System.out.println(list.size());
System.out.println(list.get("dog"));
System.out.println(list.get("cat"));
}//end m1()
public static void m2() {
HashMap< Integer,String> list = new HashMap< Integer,String>();
list.put(1,"하나");
list.put(2,"둘");
list.put(3,"셋");
System.out.println(list.get(1)); //index(x) -> key(o)
}//end m2()
public static void m3() {
HashMap< String,Boolean> list = new HashMap< String,Boolean>();
list.put("홍길동",true);
list.put("아무게",true);
list.put("하하하",false);
list.put("호호호",true);
list.put("이순신",false);
Set< String> set = list.keySet();
Iterator< String> iter = set.iterator(); //이터레이터 구현
while (iter.hasNext()) {
String key = iter.next();
System.out.println(key);
System.out.println(list.get(key));
}
}//end m3()
}