[F-Lab 모각코 챌린지 19일차] HashMap put() 뜯어보기 / 자료구조 트리 개념
2023.06.26
TIL HashMap put() 뜯어보기 자료구조 트리 개념 HashMap put() 뜯어보기 public static void main(String[] args) { HashMap map = new HashMap(); map.put("1", "짱구"); map.put("2", "철수"); map.put("1", "맹구"); } public V put(K key, V value) { // hash()는 보조 해시 함수로 해시충돌을 최대한 방지함 return putVal(hash(key), key, value, false, true); } static final int hash(Object key) { int h; return (key == null) ? 0 : (h = key.hashCode()) ^ (..