dw.util
Class Iterator
dw.util.Iterator
The Iterator class allows you to access items in a collection.
All Known Subclasses
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
To get an instance of this class, use one of the subclass constructors.
Method Summary
asList(start
:
Number, size
:
Number)
:
List
Converts a sub-sequence within the iterator into a list.
hasNext()
:
boolean
Indicates if there are more elements.
Methods inherited from class
Object
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Method Detail
asList
asList()
:
List
Convert the iterator into a list. After this conversion the
iterator is empty and hasNext() will always return false.
Note: This method should be used with care. For example a large database
result is pulled into memory completely with this method and can cause
an OutOfMemory situation.
Returns:
the iterator as a list.
asList
Converts a sub-sequence within the iterator into a list.
Note: This method should be used with care. For example a large database
result is pulled into memory completely with this method and can cause
an OutOfMemory situation.
Parameters:
start
-
the number of elements to iterate before adding elements to the sublist. Negative values are treated as 0.
size
-
the maximum number of elements to add to the sublist. Nonpositive values always result in empty list.
Returns:
a sub-sequence within the iterator into a list.
hasNext
hasNext()
:
boolean
Indicates if there are more elements.
Returns:
true if there are more elements, false otherwise.
next
next()
:
Object
Returns the next element from the Iterator.
Returns:
the next element from the Iterator.