package codearea.control;


public interface StyleSpans<S> extends Iterable<StyleSpan<S>>, TwoDimensional {
    int length();
    int getSpanCount();
    StyleSpan<S> getStyleSpan(int index);
    StyleSpans<S> subView(Position from, Position to);
}

@@ -20,16 +20,221 @@
 ntrol;%0A%0A
+import java.util.Iterator;%0Aimport java.util.Spliterator;%0Aimport java.util.function.Consumer;%0Aimport java.util.function.UnaryOperator;%0Aimport java.util.stream.Stream;%0Aimport java.util.stream.StreamSupport;%0A
 %0Apublic 
@@ -444,11 +444,1396 @@
 ion to);
+%0A%0A    default StyleSpans%3CS%3E mapStyles(UnaryOperator%3CS%3E mapper) %7B%0A        StyleSpansBuilder%3CS%3E builder = new StyleSpansBuilder%3C%3E(getSpanCount());%0A        for(StyleSpan%3CS%3E span: this) %7B%0A            builder.add(mapper.apply(span.getStyle()), span.getLength());%0A        %7D%0A        return builder.create();%0A    %7D%0A%0A    default Stream%3CS%3E styleStream() %7B%0A        return stream().map(span -%3E span.getStyle());%0A    %7D%0A%0A    default Stream%3CStyleSpan%3CS%3E%3E stream() %7B%0A        Spliterator%3CStyleSpan%3CS%3E%3E spliterator = new Spliterator%3CStyleSpan%3CS%3E%3E() %7B%0A            private final Iterator%3CStyleSpan%3CS%3E%3E iterator = iterator();%0A%0A            @Override%0A            public boolean tryAdvance(Consumer%3C? super StyleSpan%3CS%3E%3E action) %7B%0A                if(iterator.hasNext()) %7B%0A                    action.accept(iterator.next());%0A                    return true;%0A                %7D else %7B%0A                    return false;%0A                %7D%0A            %7D%0A%0A            @Override%0A            public Spliterator%3CStyleSpan%3CS%3E%3E trySplit() %7B%0A                return null;%0A            %7D%0A%0A            @Override%0A            public long estimateSize() %7B%0A                return getSpanCount();%0A            %7D%0A%0A            @Override%0A            public int characteristics() %7B%0A                return Spliterator.IMMUTABLE %7C Spliterator.SIZED;%0A            %7D%0A        %7D;%0A%0A        return StreamSupport.stream(spliterator, false);%0A    %7D
 %0A%7D%0A

Add stream(), styleStream(), mapStyles() methods to StyleSpans.