Class: List

List


new List()

Container class. Represents a list of other elements. Helper class.
Source:
List.js
Example
// Loop through a list the JavaScript way
theList.each(function(element) {
	console.log(element);
});

// Loop through a list the Java way:
var it = theList.iterator();
while(it.hasNext()) {
	var element = it.next();
	console.log(element);
}

// Loop through a list the good old fashioned way: 
for(var i=0; i < theList.size(); i++){
	var element = theList.get(i);
	console.log(element);
}

Members


empty :Boolean

True if no elements are inside the list. Read-Only
Type:
  • Boolean
Source:
List.js

Methods


size()

Returns the number of elements inside the list
Source:
List.js
Returns:
Number of elements
Type
Number

iterator()

Returns an iterator object to loop over the list
Source:
List.js
Returns:
iterator object
Type
Iterator

get(index)

Returns the element at the index position in thelist
Parameters:
Name Type Description
index Number index number to get
Source:
List.js
Returns:
Requested object
Type
Object

each(forEachElement)

JavaScript-like callback to loop over all items
Parameters:
Name Type Description
forEachElement function Will be called for each available items. Needs to have one parameter.
Source:
List.js