boolean (@NotNull List<TextRange> ranges, @NotNull TextRange range) { for (TextRange r : ranges) { if (range.contains(r)) { continue; } if (range.intersectsStrict(r)) { return true; } } return false; }