충돌이 발생하면 각 데이터를 해당 주소에 있는 링크드 리스트에 삽입하여 문제를 해결하는 방법
해시 충돌 시 새로운 주소를 찾는 방법
선형 탐사
hash 충돌 시, n칸씩 뒤에 넣기
cluster 발생 (데이터 뭉쳐있는 현상) 가능
제곱 탐사
이중 해싱
해시 함수를 2개 사용
1개는 key값 찾는데 사용, 나머지 1개는 해시 충돌시 사용
HashMap
LinkedHashMap
static class Entry<K,V> extends HashMap.Node<K,V> {
Entry<K,V> before, after;
Entry(int hash, K key, V value, Node<K,V> next) {
super(hash, key, value, next);
}
}
TreeMap