Interface ShortAppender


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

    Fields
    Modifier and Type
    Field
    Description
    static final ShortAppender
    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 ShortAppender
    An alternative ShortAppender constant that appends five Base.BASE90 digits for every short input.
  • Method Summary

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

    • DEFAULT

      static final ShortAppender 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(int) when you want to use that as an ShortAppender. This actually calls Base.appendSigned(CharSequence, short) on Base.BASE10, and works with more than StringBuilder.
    • DENSE

      static final ShortAppender DENSE
      An alternative ShortAppender constant that appends five Base.BASE90 digits for every short 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.
  • Method Details

    • apply

      <S extends CharSequence & Appendable> S apply(S sb, short 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