ExtraChecksInfo () { if (!EXTRA_CONSISTENCY_CHECKS) { return null; } int[] maxAllocatedId = new int[]{0}; try { myForwardIndex.processEntries((inputId, data) -> { if (maxAllocatedId[0] < inputId) maxAllocatedId[0] = inputId; }); } catch (StorageException e) { LOG.error("MappedFileTypeIndex extra check init fail", e); } var invertedIndexInitKeys = new ArrayList<>(myInvertedIndex.keySet()); invertedIndexInitKeys.sort(Comparator.naturalOrder()); var invertedIndexInitKeysRanges = new ArrayList<IntRange>(); var lastRangeStart = -1; var lastRangeEnd = -1; for (int key : invertedIndexInitKeys) { if (lastRangeStart == -1) { lastRangeStart = key; lastRangeEnd = key; } else if (lastRangeEnd == key - 1) { lastRangeEnd = key; } else { invertedIndexInitKeysRanges.add(new IntRange(lastRangeStart, lastRangeEnd)); lastRangeStart = key; lastRangeEnd = key; } } if (lastRangeStart != -1) { invertedIndexInitKeysRanges.add(new IntRange(lastRangeStart, lastRangeEnd)); } return new ExtraChecksInfo(maxAllocatedId[0], invertedIndexInitKeysRanges); }