@Override
        public T put(int pos, T value, OffsetKeyedTreeMap.RemappingFunction<T> remappingFunction) {
            int index = Collections.binarySearch(this.list, new Entry<>(pos, null), Comparator.comparingInt(e -> e.offset));
            if (index < 0) {
                index = ~index;
                list.add(index, new Entry<>(pos, value));
            } else {
                Entry<T> e = this.list.get(index);
                if (remappingFunction != null) {
                    value = remappingFunction.apply(e.offset, value, e.data);
                }
                e.data = value;
            }
            return value;
        }
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