Skip to main content
Version: Java (Groovy)

newTable

The newTable method creates an in-memory table from a list of columns. Each column must have an equal number of elements.

Syntax

newTable(size, names, columnSources)
newTable(size, columns)
newTable(definition)
newTable(columnHolders...)
newTable(definition, columnHolders...)

Parameters

ParameterTypeDescription
columnHoldersColumnHolder...

A list of columnHolders from which to create the new table.

Columns are created using the following methods:

namesString...

A list of column names.

sizelong

The number of rows to allocate.

columnsMap

A Map of column names and ColumnSources.

definitionTableDefinition

The TableDefinition (column names and properties) to use for the new table.

Returns

An in-memory table.

Examples

The following example creates a table with one column of three integer values.

result = newTable(
intCol("IntegerColumn", 1, 2, 3)
)

The following example creates a table with a double and a string column.

result = newTable(
doubleCol("Doubles", 3.1, 5.45, -1.0),
stringCol("Strings", "Creating", "New", "Tables")
)