TopLevel
Class Iterator
Iterator
An Iterator is a special object that lets you access items from a
collection one at a time, while keeping track of its current position
within that sequence.
Constructor Summary
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
Constructor Detail
Iterator
public Iterator(object
:
Object)
Creates an Iterator instance for the specified object.
The Iterator for the object is created by calling the
object's __iterator__ method. If there is no __iterator__ method,
a default iterator is created. The default iterator provides access to
the object's properties, according to the usual for...in and for
each...in model.
If you want to provide a custom iterator, you should override
the __iterator__ method to return an instance of your custom iterator.
Parameters:
object
-
the object whose values will be accessible via the Iterator.
Iterator
public Iterator(object
:
Object, keysOnly
:
boolean)
Creates an Iterator instance for the specified object's keys.
The Iterator for the object is created by calling the
object's __iterator__ method. If there is no __iterator__ method,
a default iterator is created. The default iterator provides access to
the object's properties, according to the usual for...in and for
each...in model.
If you want to provide a custom iterator, you should override
the __iterator__ method to return an instance of your custom iterator.
Parameters:
object
-
the object whose keys or values will be accessible via the Iterator.
keysOnly
-
if true, provides access to the object's keys. If false, provides access to the object's values.
Method Detail
next
next()
:
Object
Returns the next item in the iterator. If there are no items left,
the StopIteration exception is thrown. You should generally use this method
in the context of a try...catch block to handle the StopIteration case.
There is no guaranteed ordering of the data.
Returns:
the next item in the iterator.
See Also: