public class DataTables
extends java.lang.Object
Constructor and Description |
---|
DataTables() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Iterable<? extends java.lang.Iterable<?>> |
table(int numberOfColumns,
java.lang.Object... data)
Creates a table, i.e.
|
public static java.lang.Iterable<? extends java.lang.Iterable<?>> table(int numberOfColumns, java.lang.Object... data)
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
numberOfColumns
- the number of columns the resulting table should havedata
- 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 datadata
, but in a two-dimensional formjava.lang.IllegalArgumentException
- if data.length % numberOfColumns != 0