void (final Consumer<? super TextRange> consumerExcluded, final Consumer<? super TextRange> consumerIncluded) { if (myTransformations.isEmpty()) { consumerExcluded.consume(new UnfairTextRange(0, myLines.size() - 1)); } else { final Set<Map.Entry<TextRange,MyAppliedData>> entries = myTransformations.entrySet(); final Iterator<Map.Entry<TextRange, MyAppliedData>> iterator = entries.iterator(); assert iterator.hasNext(); final Map.Entry<TextRange, MyAppliedData> first = iterator.next(); final TextRange range = first.getKey(); if (range.getStartOffset() > 0) { consumerExcluded.consume(new TextRange(0, range.getStartOffset() - 1)); } consumerIncluded.consume(range); int previousEnd = range.getEndOffset() + 1; while (iterator.hasNext() && previousEnd < myLines.size()) { final Map.Entry<TextRange, MyAppliedData> entry = iterator.next(); final TextRange key = entry.getKey(); consumerExcluded.consume(new UnfairTextRange(previousEnd, key.getStartOffset() - 1)); consumerIncluded.consume(key); previousEnd = key.getEndOffset() + 1; } if (previousEnd < myLines.size()) { consumerExcluded.consume(new TextRange(previousEnd, myLines.size() - 1)); } } }