Klasse Row

Alle implementierten Schnittstellen:
Serializable, Iterable<Comparable<?>>

public class Row extends DataAccessor

A live view of one row of a data source. Reading from it reads through to the source, so a row reflects later changes to the data — in contrast to Record, which is a snapshot, and to Column, which copies its values.

Row row = data.getRow(2);
Comparable<?> value = row.get(3);   // column 3 of row 2
int columns = row.size();

Because the row keeps only the source and an index, it does not notice when rows are inserted or removed before it: it then refers to whatever row now sits at that index. Nothing checks that the index is still valid, so a row that outlives the data it points into will return null or throw when read.

Siehe auch:
  • Konstruktordetails

    • Row

      public Row(DataSource source, int row)
      Initializes a new view on the specified row of a data source. The index is not validated here; an invalid one only shows when the row is read.
      Parameter:
      source - Data source to read through to.
      row - Row index, starting at 0.
  • Methodendetails

    • get

      public Comparable<?> get(int col)
      Beschreibung aus Klasse kopiert: DataAccessor
      Returns the value of the data source for the specified index.
      Angegeben von:
      get in Klasse DataAccessor
      Parameter:
      col - Index.
      Gibt zurück:
      Value of the accessed cell.
    • size

      public int size()
      Beschreibung aus Klasse kopiert: DataAccessor
      Returns the number of elements in this column.
      Angegeben von:
      size in Klasse DataAccessor
      Gibt zurück:
      Number of elements
    • isColumnNumeric

      public boolean isColumnNumeric(int columnIndex)
      Returns whether the column at the specified index contains numbers.
      Parameter:
      columnIndex - Index of the column to test.
      Gibt zurück:
      true if the column is numeric, otherwise false.