Class ListPrinter

All Implemented Interfaces:
Closeable, AutoCloseable

public class ListPrinter extends Object implements Closeable
Helper which assures consistent printing of lists prefixed with `start`, separated by `separator` and suffixed by `end`.
If there is no item in the list then it prints `start` and then `end`
If there is one item in the list then it prints `start`, item and then `end`
If there is more then one items in the list then it prints `start`, items separated by `separator` and then `end`
  • Constructor Details

    • ListPrinter

      public ListPrinter(TokenWriter printerHelper, boolean startPrefixSpace, String start, boolean startSuffixSpace, boolean nextPrefixSpace, String next, boolean nextSuffixSpace, boolean endPrefixSpace, String end)
  • Method Details

    • printSeparatorIfAppropriate

      public void printSeparatorIfAppropriate()
      Call that before printing of list item starts
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable