Interface BooleanAppender


public interface BooleanAppender
A functional interface that takes and returns an object that is a CharSequence and is Appendable, appending a boolean item to it. This is not typically a method reference to anything in Base, which is different from other Appender types.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final BooleanAppender
    An alternative BooleanAppender constant that appends '1' when the given boolean item is true, or '0' when it is false.
    static final BooleanAppender
    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 BooleanAppender
    Appends boolean constants as they would be read in Java sources, as either true or false.
  • Method Summary

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

    • DEFAULT

      static final BooleanAppender 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(boolean) when you want to use that as a BooleanAppender.
    • BINARY

      static final BooleanAppender BINARY
      An alternative BooleanAppender constant that appends '1' when the given boolean item is true, or '0' when it is false. This is named differently from the DENSE method reference in other Appender functional interfaces because there's no need or ability to use base-90 digits to show true and false values densely.
      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 BooleanAppender READABLE
      Appends boolean constants as they would be read in Java sources, as either true or false.
  • Method Details

    • apply

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

      static <S extends CharSequence & Appendable> S append(S sb, boolean item)
    • appendBinary

      static <S extends CharSequence & Appendable> S appendBinary(S sb, boolean item)