MapIndexedIterator Reference
A MapIndexedIterator transforms each element of the iterator. It inherits from Iterator.
Constructor
Section titled “Constructor”Creates an iterator to transform another iterator.
var iterator = ArrayIterator([0, 1, 2]);var map_iterator = MapIterator(iterator, (i, value) -> i + value);Parameters
Section titled “Parameters”iterator: Iterator - The iterator to transform.
transform: (Number, dyn!) -> dyn! - The transform function where the first parameter is the index, and the second parameter is the element of the array.
Methods
Section titled “Methods”Inherited
Section titled “Inherited”All methods are inherited from the Iterator class. See the Iterator reference for documentation.
Example
Section titled “Example”var iterator = ArrayIterator([0, 1, 2]);MapIndexedIterator(iterator, (i, value) -> i + value).for_each(print_ln);// 0// 2// 4