Package hydra.tabular
Class Table<V>
- java.lang.Object
-
- hydra.tabular.Table<V>
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<Table<V>>
public class Table<V> extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<Table<V>>
A simple table as in a CSV file, having an optional header row and any number of data rows- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTable.Builder<V>A fluent builder forTable.
-
Field Summary
Fields Modifier and Type Field Description java.util.List<DataRow<V>>dataThe data rows of the table.static NameDATAName of thehydra.tabular.Table.datafield.Optional<HeaderRow>headerThe optional header row of the table.static NameHEADERName of thehydra.tabular.Table.headerfield.static NameTYPE_Name of thehydra.tabular.Tabletype.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <V> Table.Builder<V>builder()Creates a new fluent builder forTable.intcompareTo(Table other)booleanequals(java.lang.Object other)inthashCode()java.lang.StringtoString()TablewithData(java.util.List<DataRow<V>> data)Returns a copy of thisTablewithdatareplaced.TablewithHeader(Optional<HeaderRow> header)Returns a copy of thisTablewithheaderreplaced.
-
-
-
Field Detail
-
TYPE_
public static final Name TYPE_
Name of thehydra.tabular.Tabletype.
-
HEADER
public static final Name HEADER
Name of thehydra.tabular.Table.headerfield.
-
DATA
public static final Name DATA
Name of thehydra.tabular.Table.datafield.
-
header
public final Optional<HeaderRow> header
The optional header row of the table. If present, the header must have the same number of cells as each data row.
-
-
Constructor Detail
-
Table
public Table(Optional<HeaderRow> header, java.util.List<DataRow<V>> data)
Constructs an immutableTable.- Parameters:
header- The optional header row of the table. If present, the header must have the same number of cells as each data row.data- The data rows of the table. Each row must have the same number of cells.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(Table other)
- Specified by:
compareToin interfacejava.lang.Comparable<V>
-
withHeader
public Table withHeader(Optional<HeaderRow> header)
Returns a copy of thisTablewithheaderreplaced.
-
withData
public Table withData(java.util.List<DataRow<V>> data)
Returns a copy of thisTablewithdatareplaced.
-
builder
public static <V> Table.Builder<V> builder()
Creates a new fluent builder forTable.
-
-