Interface FloatAppender
public interface FloatAppender
A functional interface that takes and returns an object that is a CharSequence and is Appendable, appending
a
float item to it.
This is often a method reference to a method in Base, such as Base.appendSigned(CharSequence, float).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FloatAppenderA static constant to avoid Android and its R8 compiler allocating a new lambda every timeStringBuilder::appendis present at a call-site.static final FloatAppenderAn alternative FloatAppender constant that appends fiveBase.BASE90digits for every float input.static final FloatAppenderAppends float constants as they would be read in Java sources, in base 10 with a trailing'f'. -
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends CharSequence & Appendable>
SappendDense(S sb, float item) <S extends CharSequence & Appendable>
Sapply(S sb, float 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(float)when you want to use that as an FloatAppender. This actually callsBase.appendSigned(CharSequence, float)onBase.BASE10, and works with more than StringBuilder. -
DENSE
An alternative FloatAppender constant that appends fiveBase.BASE90digits for every float input. The five ASCII chars are not expected to be human-readable.
This is a static constant to avoid Android and its R8 compiler allocating a new lambda every time this lambda would be present at a call-site. -
READABLE
Appends float constants as they would be read in Java sources, in base 10 with a trailing'f'.
-
-
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
-
appendDense
-