찌든짐니
2020. 12. 18. 13:28
- Map<String, Object>: 인터페이스 형
- HashMap<String, String>: Map을 구현
- ArrayList<Map<String, String>>: ArrayList에는 여러 Map들이 존재
Map은 key와 value으로 구성된 Entity객체를 저장하는 구조를 가진 자료구조형으로
인터페이스로써 주로 Map에 대한 기본적인 구현은 HashMap, TreeMap, LinkedHashMap으로 이루어진다.
1. 선언: Map<String, Object> imap = new HashMap<String, Object>();
2. 추가: iMap.put(key, "value");
3. 삭제 iMap.remove(key);
4. 모든 값 삭제: iMap.clear();
5. 출력: System.out.println(map.get(key);
6. 전체 출력: System.out.println(map);
7. 그 외 출력: entrySet(), keySet()