(K key, V value)
| 735 | /// |
| 736 | /// - java.lang.Object#equals |
| 737 | @Override |
| 738 | public synchronized V put(K key, V value) { |
| 739 | if (key != null && value != null) { |
| 740 | int hash = key.hashCode(); |
| 741 | int index = (hash & 0x7FFFFFFF) % elementData.length; |
| 742 | Entry<K, V> entry = elementData[index]; |
| 743 | while (entry != null && !entry.equalsKey(key, hash)) { |
| 744 | entry = entry.next; |
| 745 | } |
| 746 | if (entry == null) { |
| 747 | modCount++; |
| 748 | if (++elementCount > threshold) { |
| 749 | rehash(); |
| 750 | index = (hash & 0x7FFFFFFF) % elementData.length; |
| 751 | } |
| 752 | if (index < firstSlot) { |
| 753 | firstSlot = index; |
| 754 | } |
| 755 | if (index > lastSlot) { |
| 756 | lastSlot = index; |
| 757 | } |
| 758 | entry = newEntry(key, value, hash); |
| 759 | entry.next = elementData[index]; |
| 760 | elementData[index] = entry; |
| 761 | return null; |
| 762 | } |
| 763 | V result = entry.value; |
| 764 | entry.value = value; |
| 765 | return result; |
| 766 | } |
| 767 | throw new NullPointerException(); |
| 768 | } |
| 769 | |
| 770 | /// Copies every mapping to this `Hashtable` from the specified map. |
| 771 | /// |
no test coverage detected