ArrayIterator

ArrayIterator: ArrayIterator, hasValue, value, increment, print, toList, sum

struct ArrayIterator<Element>: Iterator<Element&>, Printable

Iterates over the elements of an array.

ArrayIterator

ArrayIterator(Element[] array)

Initializes an iterator over the given array.

hasValue

bool hasValue()

Returns true if there are more elements.

value

Element& value()

Returns the current element.

increment

void increment()

Advances to the next element.

print

void print(OutputStream& stream)

Prints the remaining values in list form, e.g. [1, 2, 3].

toList

List<Element> toList()

Collects the remaining elements into a list by copying them; only sound for Copyable elements.

sum

Element sum()

Returns the sum of the remaining elements, or zero if there are none.