boolean (int offset) { if (myInsertedRanges == null) return false; Optional<TextRange> enclosingRange = myInsertedRanges.stream() .filter((range) -> range.contains(offset)) .findAny(); return enclosingRange.isPresent(); }