private void checkIteratorAtOffset(boolean forward, TestState s, Entry<Item> entry, int offset, int index) {
            Predicate<OffsetKeyedTreeMap.NodesIterator<Item>> nextOp = forward ? it -> it.next() : it -> it.prev();
            OffsetKeyedTreeMap.NodesIterator<Item> it1 = s.treeBacked.nodesIteratorAt(offset);
            OffsetKeyedTreeMap.NodesIterator<Item> it2 = s.arrayBacked.nodesIteratorAt(offset);
            Item presentedValueAtOffset = it1.getCurrValue();
            Item expectedValueAtOffset = it2.getCurrValue();
            Assert.assertEquals(entry == null ? null : entry.data, presentedValueAtOffset);
            Assert.assertEquals(expectedValueAtOffset, presentedValueAtOffset);
            if (it1.getCurrValue() != null) {
                Assert.assertEquals(offset, it1.getCurrOffset());
            }
            LinkedList<Entry<Item>> presentedEntries = new LinkedList<>();
            LinkedList<Entry<Item>> expectedEntries = new LinkedList<>();
            boolean a, b;
            do {
                a = nextOp.test(it1);
                b = nextOp.test(it2);
                Assert.assertEquals(a, b);
                presentedEntries.addLast(new Entry<>(it1.getCurrOffset(), it1.getCurrValue()));
                expectedEntries.addLast(new Entry<>(it2.getCurrOffset(), it2.getCurrValue()));
            } while (a && b);
            assertEntryStreamsEqual(expectedEntries.stream(), presentedEntries.stream());
        }
Test scenarios to cover OffsetKeyedTreeMap data structure

orderings (M)
 - ascending
 - descending
 - random
<p>
modification scenarios (P)
 - all insertions (n)
 - all insertions, then all remove (different series proportions n,m)
 - intermixed insertions and remove (different series proportions n,m)
 - all insertions, then apply offset at existing key
 - all insertions, then apply offset at missing key
 - intermixed insertions, remove, apply offset (different series proportions n,m,p)
 - all insertions, then removeAtRange at existing key
 - all insertions, then removeAtRange offset at missing key
 - intermixed insertions, removeAtRange, apply offset (different series proportions n,m,p)
<p>
inspection scenarios (Q)
 - find existing key
 - find missing key
 - find existing key and iterate forward/backward till the end/head
 - find missing key and iterate forward/backward till the end/head
 - random backward-forward iterations
<p>
test/org.jkiss.dbeaver.model.lsm.test/src/org/jkiss/dbeaver/model/lsm/test/OffsetKeyedTreeMapTest.java