Class: Set

Set


new Set()

Container class. Represents a set of other elements. Helper class. Used only as a result from Establishment.storedFoodUnits.
Source:
Set.js
Example
// Loop through a Set the JavaScript way:
theSet.each(function(element) {
	console.log(element);
});

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

Members


empty :Boolean

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

Methods


size()

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

iterator()

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

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:
Set.js