Class SeparatedItemStringBuilder


  • public class SeparatedItemStringBuilder
    extends Object
    Builds a string containing a list of items with a prefix, a postfix, and a separator.
    Example: (1,2,3) which has prefix "(", separator ",", postfix ")" and the items 1 through 3.

    Java 8 offers the very nice Collectors.joining(String, String, String) which does the same thing.

    • Constructor Detail

      • SeparatedItemStringBuilder

        public SeparatedItemStringBuilder​(String prefix,
                                          String separator,
                                          String postfix)
    • Method Detail

      • hasItems

        public boolean hasItems()
      • toString

        public String toString()
        Convert the builder into its final string representation.
        Overrides:
        toString in class Object