Skip to main content
Pentaho Documentation

List

pentaho.lang.List

The List class is an abstract base class for typed arrays.

Elements of a list must implement the pentaho.lang.IListElement interface.

AMD Module

require(["pentaho/lang/List"], function(List) { /* code goes here */ });

Extends

Constructor

Name Description
new List(keyArgs)
 
Abstract

Initializes a list instance.

Members

Name Description
elemClass : Class

Gets the constructor function of the elements held by this list.

length : number

The length of the list.

Methods

Name Description
add(elem, keyArgs) : pentaho.lang.IListElement

Appends an element to the list and returns it.

addMany(elems, keyArgs) : number

Appends elements to the list and returns its new length.

push(elems) : number

Appends elements to the list and returns its new length.

toSpec() : Array

Creates a specification of this list.

Constructor Details

new List(keyArgs)
 
Abstract

Initializes a list instance.

Note that because a List is a sub-class of Array, the new operator cannot be used to create instances (at least up to ECMAScript version 5). Instead, instances of List are actually initial instances of Array whose prototype is then changed to be that of List. In other words, List is an "initialization" constructor (see pentaho.lang.ISpecifiable for more information on these concepts.

Concrete List sub-classes should provide a static to method to help in their construction.

Source: javascript/web/pentaho/lang/List.js, line 23

Parameters:
Name Default Value Summary
keyArgs : Object
 
Optional

The keyword arguments.

These are not used directly by the List class but are passed-through to the methods that handle the initialization of each list element.

Members Details

elemClass: Class

Gets the constructor function of the elements held by this list.

This class must implement the pentaho.lang.IListElement interface.

Source: javascript/web/pentaho/lang/List.js, line 80

length: number

The length of the list.

Source: javascript/web/pentaho/lang/List.js, line 86

Methods Details

add(elem, keyArgs) : pentaho.lang.IListElement

Appends an element to the list and returns it.

The value specified in argument elem is converted to the list elements' class before actually being added to it.

Source: javascript/web/pentaho/lang/List.js, line 151

Parameters:
Name Default Value Summary
elem : *

An element or a value convertible to one.

keyArgs : Object
 
Optional

The keyword arguments.

These are not used directly by the List class but are passed-through to the methods that handle the initialization of list elements.

Returns:
Name Description
pentaho.lang.IListElement

The added list element.

addMany(elems, keyArgs) : number

Appends elements to the list and returns its new length.

The values specified in elems are converted to the list elements' class before actually being added to it.

This method allows adding elements to the list using custom options (keyword arguments). Contrast with method pentaho.lang.List#push which adds elements using default options.

Source: javascript/web/pentaho/lang/List.js, line 132

Parameters:
Name Default Value Summary
elems : Array

An array of elements to add to the list.

keyArgs : Object
 
Optional

The keyword arguments.

These are not used directly by the List class but are passed-through to the methods that handle the initialization of each list element.

Returns:
Name Description
number

The new length of the list.

push(elems) : number

Appends elements to the list and returns its new length.

The values specified in elems are converted to the list elements' class before actually being added to it.

This method adds elements to the list using default options. Use one of pentaho.lang.List#add or pentaho.lang.List#addMany to be able to specify non-default options (keyword arguments).

Source: javascript/web/pentaho/lang/List.js, line 109

Parameters:
Name Default Value Summary
elems : *
 
Repeatable

The elements to add to the list.

Returns:
Name Description
number

The new length of the list.

toSpec() : Array

Creates a specification of this list.

A list specification is an array containing the specifications of each of its elements.

If the element's class does not implement pentaho.lang.ISpecifiable, each element is assumed to be its own specification.

Source: javascript/web/pentaho/lang/List.js, line 237

Returns:
Name Description
Array

The list specification.