HashMap
-
[자바] HashMap key값 반복(Iterator) 조회 하는 방법개발/Java 2019. 1. 3. 12:07
HashMap 키 값을 순서대로 조회해서 사용할 수 있다. 아래 3가지 방법과 같이... 123456789101112131415161718192021222324 HashMap testMap = new HashMap(); testMap.put("key1", "value1"); testMap.put("key2", "value2"); testMap.put("key3", "value3"); testMap.put("key4", "value4"); testMap.put("key5", "value5"); // ex1 Iterator keys = testMap.keySet().iterator(); while( keys.hasNext() ){ String key = keys.next(); System.out.printl..