S
- the style typejava.lang.Iterable<StyleSpan<S>>
, TwoDimensional
public interface StyleSpans<S> extends java.lang.Iterable<StyleSpan<S>>, TwoDimensional
StyleSpan
objects.TwoDimensional.Bias, TwoDimensional.Position
Modifier and Type | Method | Description |
---|---|---|
default StyleSpans<S> |
append(StyleSpan<S> span) |
Appends the given style to the end of the list of
StyleSpan . |
default StyleSpans<S> |
append(S style,
int length) |
Appends the given style to the end of the list of
StyleSpan . |
default StyleSpans<S> |
concat(StyleSpans<S> that) |
|
boolean |
equals(java.lang.Object other) |
Two
StyleSpans objects are considered equal if they contain equal
number of StyleSpan s and the StyleSpan s are pairwise
equal. |
int |
getSpanCount() |
|
StyleSpan<S> |
getStyleSpan(int index) |
|
default java.util.Iterator<StyleSpan<S>> |
iterator() |
|
int |
length() |
|
default StyleSpans<S> |
mapStyles(java.util.function.UnaryOperator<S> mapper) |
Returns a new
StyleSpans object that has the same total length
as this StyleSpans and style of every span is mapped by the given
function. |
default StyleSpans<S> |
overlay(StyleSpans<S> that,
java.util.function.BiFunction<? super S,? super S,? extends S> f) |
Applies the given bifunction
f to this object's StyleSpan objects and
that StyleSpan objects and stores the result in the returned StyleSpans object. |
default StyleSpans<S> |
prepend(StyleSpan<S> span) |
Prepends the given style to the start of the list of
StyleSpan . |
default StyleSpans<S> |
prepend(S style,
int length) |
Prepends the given style to the start of the list of
StyleSpan . |
static <S> StyleSpans<S> |
singleton(StyleSpan<S> span) |
Creates a
StyleSpans object that only contains one StyleSpan object. |
static <S> StyleSpans<S> |
singleton(S style,
int length) |
Creates a
StyleSpans object that only contains one StyleSpan object. |
default java.util.stream.Stream<StyleSpan<S>> |
stream() |
Returns a stream of this list'
StyleSpan objects. |
default java.util.stream.Stream<S> |
styleStream() |
Returns a stream of just this list of
StyleSpan 's styles. |
default StyleSpans<S> |
subView(int from,
int to) |
Same as
List.subList(int, int) |
default StyleSpans<S> |
subView(TwoDimensional.Position from,
TwoDimensional.Position to) |
Same as
List.subList(int, int) , except that the arguments are two dimensional. |
offsetToPosition, position
static <S> StyleSpans<S> singleton(S style, int length)
StyleSpans
object that only contains one StyleSpan
object.static <S> StyleSpans<S> singleton(StyleSpan<S> span)
StyleSpans
object that only contains one StyleSpan
object.int length()
int getSpanCount()
boolean equals(java.lang.Object other)
StyleSpans
objects are considered equal if they contain equal
number of StyleSpan
s and the StyleSpan
s are pairwise
equal.equals
in class java.lang.Object
default java.util.Iterator<StyleSpan<S>> iterator()
iterator
in interface java.lang.Iterable<S>
default StyleSpans<S> append(S style, int length)
StyleSpan
.default StyleSpans<S> append(StyleSpan<S> span)
StyleSpan
.default StyleSpans<S> prepend(S style, int length)
StyleSpan
.default StyleSpans<S> prepend(StyleSpan<S> span)
StyleSpan
.default StyleSpans<S> subView(int from, int to)
List.subList(int, int)
default StyleSpans<S> subView(TwoDimensional.Position from, TwoDimensional.Position to)
List.subList(int, int)
, except that the arguments are two dimensional.default StyleSpans<S> concat(StyleSpans<S> that)
default StyleSpans<S> mapStyles(java.util.function.UnaryOperator<S> mapper)
StyleSpans
object that has the same total length
as this StyleSpans and style of every span is mapped by the given
function. Adjacent style spans whose style mapped to the same value are
merged into one. As a consequence, the returned StyleSpans might have
fewer style spans than this StyleSpans.mapper
- function to calculate new styledefault StyleSpans<S> overlay(StyleSpans<S> that, java.util.function.BiFunction<? super S,? super S,? extends S> f)
f
to this object's StyleSpan
objects and
that
StyleSpan
objects and stores the result in the returned StyleSpans
object.default java.util.stream.Stream<S> styleStream()
StyleSpan
's styles.