JAVA(SPRINGBOOT)
[JAVA] Hashmap
본듀
2022. 11. 1. 16:26
Hashmap 이란?
HashMap은 Map인터페이스에 속해있는 컬렉션
키를 해싱하여 자료를 저장하고 꺼내오기 때문에 속도가 빠르다.
Hashmap 선언하기
HashMap<type, type> hashmap = new HashMap<>();
Hashmap 이용하기
- 값 추가하기
hashmap.put(key, value);
- 값 삭제하기
hashmap.remove(key);
hashmap.clear();
- 크기 구하기
int size = hashmap.size();