MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / rehash

Method rehash

vm/JavaAPI/src/java/util/HashMap.java:601–618  ·  view source on GitHub ↗
(int capacity)

Source from the content-addressed store, hash-verified

599 }
600
601 void rehash(int capacity) {
602 int length = calculateCapacity((capacity == 0 ? 1 : capacity << 1));
603
604 Entry<K, V>[] newData = newElementArray(length);
605 for (int i = 0; i < elementData.length; i++) {
606 Entry<K, V> entry = elementData[i];
607 elementData[i] = null;
608 while (entry != null) {
609 int index = entry.origKeyHash & (length - 1);
610 Entry<K, V> next = entry.next;
611 entry.next = newData[index];
612 newData[index] = entry;
613 entry = next;
614 }
615 }
616 elementData = newData;
617 computeThreshold();
618 }
619
620 void rehash() {
621 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