Class ListDataTable

    • Constructor Detail

      • ListDataTable

        public ListDataTable​(String id,
                             String description,
                             Collection<DataColumn<?>> columns)
        Constructor with a regular collection.
        Parameters:
        id - String; id
        description - String; description
        columns - Collection<DataColumn<?>>; columns
      • ListDataTable

        public ListDataTable​(String id,
                             String description,
                             ImmutableList<DataColumn<?>> columns)
        Constructor with an immutable list.
        Parameters:
        id - String; id
        description - String; description
        columns - ImmutableList<DataColumn<?>>; columns
    • Method Detail

      • iterator

        public Iterator<DataRecord> iterator()


        It is imperative that the user manually synchronize on the returned list when traversing it via Iterator, Spliterator or Stream when there is a risk of adding records while traversing the iterator:
          List list = Collections.synchronizedList(new ArrayList());
              ...
          synchronized (list) 
          {
              Iterator i = list.iterator(); // Must be in synchronized block
              while (i.hasNext())
                  foo(i.next());
          }
         
        Failure to follow this advice may result in non-deterministic behavior.

      • isEmpty

        public boolean isEmpty()
        Returns whether the table is empty.
        Returns:
        whether the table is empty
      • addRecordByColumns

        public void addRecordByColumns​(Map<DataColumn<?>,​Object> data)
        Adds a record to the table, based on a map with columns and values.
        Parameters:
        data - Map<DataColumn<?>, 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
        NullPointerException - when data is null
      • addRecordByColumns

        public void addRecordByColumns​(ImmutableMap<DataColumn<?>,​Object> data)
        Adds a record to the table, based on an immutable map with columns and values.
        Parameters:
        data - ImmutableMap<DataColumn<?>, 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
        NullPointerException - when data is null
      • addRecordByColumnIds

        public void addRecordByColumnIds​(Map<String,​Object> data)
        Adds a record to the table, based on a map with column ids and values.
        Parameters:
        data - Map<String, Object>; immutable 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
        NullPointerException - when data is null
      • addRecordByColumnIds

        public void addRecordByColumnIds​(ImmutableMap<String,​Object> data)
        Adds a record to the table, based on an immutable map with column ids and values.
        Parameters:
        data - ImmutableMap<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
        NullPointerException - when data is null
      • addRecord

        public void addRecord​(Object[] data)
        Adds a record 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[]; record data
        Throws:
        IllegalArgumentException - when the size, order or data types in the Object[] do not comply to the columns
        NullPointerException - when data is null