int (final @NotNull AtomicReferenceArray<PageImpl> pages, final int pageIndex) { //RC: this is a reduced copy of findPageOrInsertionIndex() -> better adjust // findPageOrInsertionIndex() to return probes count via additional out-param. final int length = pages.length(); final int initialSlotIndex = hash(pageIndex) % length; final int probeStep = 1; //=linear probing for (int slotIndex = initialSlotIndex, probeNo = 0; probeNo < length; probeNo++) { final PageImpl page = pages.get(slotIndex); if (page == null) { return probeNo; } if (page.isTombstone()) { //Tombstone: page was removed -> look up further } else if (page.pageIndex() == pageIndex) { return probeNo; } slotIndex = (slotIndex + probeStep) % length; } //no page found return pages.length(); }