Package hydra.tabular

Class 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
    • Field Detail

      • TYPE_

        public static final Name TYPE_
        Name of the hydra.tabular.Table type.
      • HEADER

        public static final Name HEADER
        Name of the hydra.tabular.Table.header field.
      • DATA

        public static final Name DATA
        Name of the hydra.tabular.Table.data field.
      • 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.
      • data

        public final java.util.List<DataRow<V>> data
        The data rows of the table. Each row must have the same number of cells.
    • Constructor Detail

      • Table

        public Table​(Optional<HeaderRow> header,
                     java.util.List<DataRow<V>> data)
        Constructs an immutable Table.
        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:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(Table other)
        Specified by:
        compareTo in interface java.lang.Comparable<V>
      • withData

        public Table withData​(java.util.List<DataRow<V>> data)
        Returns a copy of this Table with data replaced.
      • builder

        public static <V> Table.Builder<V> builder()
        Creates a new fluent builder for Table.