Interface CharAppender
public interface CharAppender
A functional interface that takes and returns an object that is a CharSequence and is Appendable, appending
a
byte item to it.
This is often a method reference to a method in Base, such as Base.appendSigned(CharSequence, char).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CharAppenderA static constant to avoid Android and its R8 compiler allocating a new lambda every timeStringBuilder::appendis present at a call-site.static final CharAppenderAppends the given char in single quotes, with a backslash-escape if it would be necessary in Java sources.static final CharAppenderAppends char constants as they would be read in Java sources, in single quotes, with backslash escapes if necessary. -
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends CharSequence & Appendable>
Sappend(S sb, char item) <S extends CharSequence & Appendable>
Sapply(S sb, char item) Appendsitemtosband returnssbfor chaining.
-
Field Details
-
DEFAULT
A static constant to avoid Android and its R8 compiler allocating a new lambda every timeStringBuilder::appendis present at a call-site. This should be used in place ofStringBuilder.append(char)when you want to use that as a CharAppender.
This functional interface doesn't have aDENSEmethod reference because appending one shown char per char item is really as dense as you can get already. -
QUOTED
Appends the given char in single quotes, with a backslash-escape if it would be necessary in Java sources. -
READABLE
Appends char constants as they would be read in Java sources, in single quotes, with backslash escapes if necessary.
-
-
Method Details
-
apply
Appendsitemtosband returnssbfor chaining.- Type Parameters:
S- any type that is both a CharSequence and an Appendable, such as StringBuilder, StringBuffer, CharBuffer, or CharList- Parameters:
sb- an Appendable CharSequence that will be modified, such as a StringBuilderitem- the item to append- Returns:
first, after modification
-
append
-