boolean (@Nullable FindResult input) { if (input == null || !input.isStringFound()) return true; NavigableMap<Integer, Integer> map = mySkipRangesSet.headMap(input.getStartOffset(), true); for(Map.Entry<Integer, Integer> e:map.descendingMap().entrySet()) { // [e.key, e.value] intersect with [input.start, input.end] if (e.getKey() <= input.getStartOffset() && (input.getStartOffset() <= e.getValue() || e.getValue() >= input.getEndOffset())) return false; if (e.getValue() <= input.getStartOffset()) break; } return true; }