MCPcopy Create free account
hub / github.com/davidgiven/luje / rehash

Method rehash

lib/java/util/HashMap.java:632–649  ·  view source on GitHub ↗
(int capacity)

Source from the content-addressed store, hash-verified

630 }
631
632 void rehash(int capacity) {
633 int length = calculateCapacity((capacity == 0 ? 1 : capacity << 1));
634
635 Entry<K, V>[] newData = newElementArray(length);
636 for (int i = 0; i < elementData.length; i++) {
637 Entry<K, V> entry = elementData[i];
638 elementData[i] = null;
639 while (entry != null) {
640 int index = entry.origKeyHash & (length - 1);
641 Entry<K, V> next = entry.next;
642 entry.next = newData[index];
643 newData[index] = entry;
644 entry = next;
645 }
646 }
647 elementData = newData;
648 computeThreshold();
649 }
650
651 void rehash() {
652 rehash(elementData.length);

Callers 2

putImplMethod · 0.95
putAllImplMethod · 0.95

Calls 3

calculateCapacityMethod · 0.95
newElementArrayMethod · 0.95
computeThresholdMethod · 0.95

Tested by

no test coverage detected