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

Method rehash

Ports/CLDC11/src/java/util/HashMap.java:615–632  ·  view source on GitHub ↗
(int capacity)

Source from the content-addressed store, hash-verified

613 }
614
615 void rehash(int capacity) {
616 int length = calculateCapacity((capacity == 0 ? 1 : capacity << 1));
617
618 Entry<K, V>[] newData = newElementArray(length);
619 for (int i = 0; i < elementData.length; i++) {
620 Entry<K, V> entry = elementData[i];
621 elementData[i] = null;
622 while (entry != null) {
623 int index = entry.origKeyHash & (length - 1);
624 Entry<K, V> next = entry.next;
625 entry.next = newData[index];
626 newData[index] = entry;
627 entry = next;
628 }
629 }
630 elementData = newData;
631 computeThreshold();
632 }
633
634 void rehash() {
635 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