Interface DoubleAppender


public interface DoubleAppender
A functional interface that takes and returns an object that is a CharSequence and is Appendable, appending a double item to it. This is often a method reference to a method in Base, such as Base.appendFriendly(CharSequence, double).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final DoubleAppender
    A static constant to avoid Android and its R8 compiler allocating a new lambda every time StringBuilder::append is present at a call-site.
    static final DoubleAppender
    An alternative DoubleAppender constant that appends ten Base.BASE90 digits for every double input.
    static final DoubleAppender
    Appends double constants as they would be read in Java sources, in base 10 using either decimal or scientific format (depending on scale).
  • Method Summary

    Modifier and Type
    Method
    Description
    static <S extends CharSequence & Appendable>
    S
    appendDense(S sb, double item)
     
    <S extends CharSequence & Appendable>
    S
    apply(S sb, double item)
    Appends item to sb and returns sb for chaining.
  • Field Details

    • DEFAULT

      static final DoubleAppender DEFAULT
      A static constant to avoid Android and its R8 compiler allocating a new lambda every time StringBuilder::append is present at a call-site. This should be used in place of StringBuilder.append(double) when you want to use that as an DoubleAppender. This actually calls Base.appendGeneral(CharSequence, double) on Base.BASE10, and works with more than StringBuilder.
    • DENSE

      static final DoubleAppender DENSE
      An alternative DoubleAppender constant that appends ten Base.BASE90 digits for every double input. The ten 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

      static final DoubleAppender READABLE
      Appends double constants as they would be read in Java sources, in base 10 using either decimal or scientific format (depending on scale).
  • Method Details

    • apply

      <S extends CharSequence & Appendable> S apply(S sb, double item)
      Appends item to sb and returns sb for 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 StringBuilder
      item - the item to append
      Returns:
      first, after modification
    • appendDense

      static <S extends CharSequence & Appendable> S appendDense(S sb, double item)