Table

trait Table

Defines table.

How to Create Table

A Table can be created using a factory defined in companion object, or it can be built incrementally using a TableBuilder.

The two tables created in the example below are effectively the same.

// Create table with data supplied as Seq[Seq[String]]
val table1 = t2.Table(
 Seq(
   Seq("#", "Effective Date", "Currency Code", "Exchange Rate"),
   Seq("1", "2021-01-04", "USD", "0.690236"),
   Seq("2", "2021-01-05", "USD", "0.690627"),
   Seq("3", "2021-01-06", "USD", "0.689332")
 )
)

// Incrementally build table by adding value sequences
val table2 = t2.TableBuilder()
 .add("#", "Effective Date", "Currency Code", "Exchange Rate")
 .add("1", "2021-01-04", "USD", "0.690236")
 .add("2", "2021-01-05", "USD", "0.690627")
 .add("3", "2021-01-06", "USD", "0.689332")
 .build()

// Assert equality
assert(table1.rows == table2.rows)
See also:
Companion:
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def apply(row: Int, column: Int): String

Gets value at given location.

Gets value at given location.

Value parameters:
column

column index

row

row index

def column(index: Int): Seq[String]

Gets column values at given index.

Gets column values at given index.

Value parameters:
index

column index

def columnCount: Int

Gets column count.

Gets column count.

def columns: Seq[Seq[String]]

Gets column-oriented data.

Gets column-oriented data.

def row(index: Int): Seq[String]

Gets row values at given index.

Gets row values at given index.

Value parameters:
index

row index

def rowCount: Int

Gets row count.

Gets row count.

def rows: Seq[Seq[String]]

Gets row-oriented data.

Gets row-oriented data.