- map에서 간단하게 반복문을 사용하는 방법
예제
HashMap<String, Object> test = new HashMap<String, Object>();test.put("a" ,123.0);test.put("b" ,123.1);for( String key : test.keySet() ){ System.out.println( String.format("키 : %s, 값 : %s", key, test.get(key)) );} |
결과
키 : a, 값 : 123.0키 : b, 값 : 123.1 |