OffsetMap (@NotNull Document anotherDocument, @NotNull Function<? super Integer, Integer> mapping) { OffsetMap result = new OffsetMap(anotherDocument); for (OffsetKey key : getAllOffsets()) { result.addOffset(key, mapping.apply(getOffset(key))); } return result; }