Class DataTables


  • public class DataTables
    extends java.lang.Object
    A utility class to create data tables.
    • Constructor Summary

      Constructors 
      Constructor Description
      DataTables()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Iterable<? extends java.lang.Iterable<?>> table​(int numberOfColumns, java.lang.Object... data)
      Creates a table, i.e.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DataTables

        public DataTables()
    • Method Detail

      • table

        public static java.lang.Iterable<? extends java.lang.Iterable<?>> table​(int numberOfColumns,
                                                                                java.lang.Object... data)
        Creates a table, i.e. a list of lists, with numberOfColumns columns from the given data including the header.

        Example:

        
             table(2,
                "name", "age", // header
                "Peter", 20,   // first row of data
                "Susan", 35);  // second row of data
         
        Parameters:
        numberOfColumns - the number of columns the resulting table should have
        data - the data of the table represented as a one-dimensional list, the number of entries must be a multiple of numberOfColumns. The first numberOfColumns elements are taken as the header of the table, the remaining values as data
        Returns:
        a list of list that contains the same data as data, but in a two-dimensional form
        Throws:
        java.lang.IllegalArgumentException - if data.length % numberOfColumns != 0