Collection
pentaho.lang.Collection
The Collection
class is an abstract base class for typed, ordered maps.
Remarks
A collection is a list whose elements can only be contained in one position. If an attempt is made to add a duplicate element to the collection, an error is thrown.
Additionally, collection elements can be accessed by their key, and not only by position.
Elements of a collection must implement the pentaho.lang.ICollectionElement
interface.
AMD Module
require(["pentaho/lang/Collection"], function(Collection) { /* code goes here */ });
Extends
Constructor
Name | Description |
---|---|
new Collection(keyArgs) Abstract | Initializes a collection instance. |
Members
Name | Description |
---|---|
elemClass : Abstract | Gets the constructor function of the elements held by this collection. |
length : | The length of the list. |
missingValue : | Gets the value returned by |
Methods
Name | Description |
---|---|
_getElemName() : string Protected | Gets a common name for the elements held by this list. |
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. |
get(key, assertExists) : pentaho.lang.ICollectionElement | * | Gets an element by its key. |
getExisting(key) : pentaho.lang.ICollectionElement | Gets an existing element by its key. |
has(key) : boolean | Tests if an element with a given key belongs to the collection. |
includes(elem) : boolean | Checks if a given element belongs to the collection. |
push(elems) : number | Appends elements to the list and returns its new length. |
toSpec() : Array | Creates a specification of this list. |
Constructor Details
new Collection(keyArgs) Abstract | ||||||
---|---|---|---|---|---|---|
Initializes a collection instance. Note that because a Concrete Source: javascript/web/pentaho/lang/Collection.js, line 24
|
Members Details
elemClass: Abstract |
---|
Gets the constructor function of the elements held by this collection. This class must implement the Source: javascript/web/pentaho/lang/Collection.js, line 87 Overrides: pentaho.lang.List#elemClass |
length: |
---|
The length of the list. Source: javascript/web/pentaho/lang/List.js, line 98 Inherited From: pentaho.lang.List#length |
missingValue: |
---|
Gets the value returned by Source: javascript/web/pentaho/lang/Collection.js, line 85 Default Value: null |
Methods Details
_getElemName() : string Protected | ||||
---|---|---|---|---|
Gets a common name for the elements held by this list. The default implementation returns the value of Source: javascript/web/pentaho/lang/List.js, line 94 Inherited From: pentaho.lang.List#_getElemName
|
add(elem, keyArgs) : pentaho.lang.IListElement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Appends an element to the list and returns it. The value specified in argument Source: javascript/web/pentaho/lang/List.js, line 163 Inherited From: pentaho.lang.List#add
|
addMany(elems, keyArgs) : number | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Appends elements to the list and returns its new length. The values specified in This method allows adding elements to the list using custom options (keyword arguments). Contrast with method Source: javascript/web/pentaho/lang/List.js, line 144 Inherited From: pentaho.lang.List#addMany
|
get(key, assertExists) : pentaho.lang.ICollectionElement | * | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Gets an element by its key. Source: javascript/web/pentaho/lang/Collection.js, line 181
See also: pentaho.lang.Collection#getExisting |
getExisting(key) : pentaho.lang.ICollectionElement | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Gets an existing element by its key. An error is thrown when the collection does not contain an element with the given key. Source: javascript/web/pentaho/lang/Collection.js, line 204
See also: pentaho.lang.Collection#get |
has(key) : boolean | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Tests if an element with a given key belongs to the collection. Source: javascript/web/pentaho/lang/Collection.js, line 161
|
includes(elem) : boolean | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Checks if a given element belongs to the collection. Source: javascript/web/pentaho/lang/Collection.js, line 147
|
push(elems) : number | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Appends elements to the list and returns its new length. The values specified in This method adds elements to the list using default options. Use one of Source: javascript/web/pentaho/lang/List.js, line 121 Inherited From: pentaho.lang.List#push
|
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 Source: javascript/web/pentaho/lang/List.js, line 249 Inherited From: pentaho.lang.List#toSpec
|