Class Printer

java.lang.Object
io.higson.runtime.engine.util.Printer

public final class Printer extends Object
The util class for formatting collection or array contents.
Since:
1.0.0
Author:
Przemek Hertel
  • Method Details

    • print

      public static String print(Collection<?> list, String title, int maxLines, Formatter formatter)
      Creates a string representing the contents of the list collection in readable form. Each element of the collection is listed on the next line. The user can specify the maximum number of lines that will be printed. Additionally, you can enter formatter which will be used for formatting every item in the collection. There is a limit of minimal number of lines from the bottom for maxNumber parameter - at least 3 lines.
      Parameters:
      list - collection of objects
      title - optional title of collection
      maxLines - maximum number of lines to be printed, or 0 if there are no restrictions
      formatter - object formatting each element in the collection
      Returns:
      a collection representation in which each element is presented on a separate line
    • print

      public static String print(Collection<?> list, String title)
      Print contents of given collection without limiting the number of lines.
      Parameters:
      list - collection of objects
      title - optional title of collection
      Returns:
      string representation of table content in which each element is presented on a separate line
      See Also:
    • print

      public static String print(Object[] array, String title)
      Prints content of given array without restrictions of line number.
      Parameters:
      array - array of objects
      title - optional title
      Returns:
      string representation of table content in which each element is presented on a separate line
      See Also: