Class ListTable

java.lang.Object
org.djutils.data.Table
org.djutils.data.ListTable
All Implemented Interfaces:
Iterable<Row>, org.djutils.base.Identifiable

public class ListTable extends Table
Table implementation that stores Records in a List.

Copyright (c) 2020-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUTILS License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

    • ListTable

      public ListTable(String id, String description, Collection<Column<?>> columns)
      Constructor.
      Parameters:
      id - String; id
      description - String; description
      columns - Collection<Column<?>>; columns
  • Method Details

    • iterator

      public Iterator<Row> iterator()
    • isEmpty

      public boolean isEmpty()
      Description copied from class: Table
      Returns whether the table is empty.
      Specified by:
      isEmpty in class Table
      Returns:
      whether the table is empty
    • addRow

      public void addRow(Map<Column<?>,Object> data)
      Adds a row to the table.
      Parameters:
      data - Map<String, Object>; data with values given per column
      Throws:
      IllegalArgumentException - when the size or data types in the data map do not comply to the columns
    • addRowByColumnIds

      public void addRowByColumnIds(Map<String,Object> data)
      Adds a row to the table.
      Parameters:
      data - Map<String, Object>; data with values given per column id
      Throws:
      IllegalArgumentException - when the size or data types in the data map do not comply to the columns
    • addRow

      public void addRow(Object[] data)
      Adds a row to the table. The order in which the elements in the array are offered should be the same as the order of the columns.
      Parameters:
      data - Object[]; row data
      Throws:
      IllegalArgumentException - when the size, order or data types in the Object[] do not comply to the columns