/** * Shifts left entries with the specified hash code, starting at the specified position, and * empties the resulting free entry. If any entry wraps around the table, instantiates lazily * {@link #wrapped} and stores the entry key. * * @param pos a starting position. * @return the position cleared by the shifting process. */ protected final int shiftKeys(int pos) { // Shift entries with the same hash. int last, slot; for (; ; ) { pos = ((last = pos) + 1) & mask; while (used[pos]) { slot = (it.unimi.dsi.fastutil.HashCommon.murmurHash3(strategy.hashCode(key[pos]))) & mask; if (last <= pos ? last >= slot || slot > pos : last >= slot && slot > pos) break; pos = (pos + 1) & mask; } if (!used[pos]) break; if (pos < last) { // Wrapped entry. if (wrapped == null) wrapped = new DoubleArrayList(); wrapped.add(key[pos]); } key[last] = key[pos]; value[last] = value[pos]; } used[last] = false; return last; }