next
method and it needs to throw a goog.iter.StopIteration when the
iteration passes beyond the end. Iterators have no hasNext method.
It is recommended to always use the helper functions to iterate over the
iterator or in case you are only targeting JavaScript 1.7 for in loops.|
Takes zero or more iterators and returns one iterator that will iterate over
them in the order chained.
Arguments:
Returns:
Returns a new iterator that will iterate over all the given iterators' contents.
|
code » | |||||
|
Create an iterator to cycle over the iterable's elements indefinitely.
For example, ([1, 2, 3]) would return : 1, 2, 3, 1, 2, 3, ...
Arguments:
Returns:
An iterator that iterates indefinitely over the values in
iterable.
|
code » | |||||
|
Builds a new iterator that iterates over the original, but skips elements as
long as a supplied function returns true.
Arguments:
Returns:
A new iterator that drops elements from the original iterator as long as
f is true.
|
code » | |||||
|
Iterates over 2 iterators and returns true if they contain the same sequence
of elements and have the same length.
Arguments:
Returns:
true if the iterators contain the same sequence of elements and have the same length.
|
code » | |||||
|
Goes through the values in the iterator. Calls f for each these and if any of
them returns false this returns false (without checking the rest). If all
return true this will return true.
Arguments:
Returns:
true if every value passes the test.
|
code » | |||||
|
Calls a function for every element in the iterator, and if the function
returns true adds the element to a new iterator.
Arguments:
Returns:
A new iterator in which only elements that passed the test are present.
|
code » | |||||
goog.iter.forEach(iterable, f, opt_obj)
Calls a function for each element in the iterator with the element of the
iterator passed as argument.
Arguments:
|
code » | |||||
|
Joins the values in a iterator with a delimiter.
Arguments:
Returns:
The joined value string.
|
code » | |||||
|
For every element in the iterator call a function and return a new iterator
with that value.
Arguments:
Returns:
A new iterator that returns the results of applying the function to each element in the original iterator.
|
code » | |||||
goog.iter.nextOrValue(iterable, defaultValue)
⇒ *
Advances the iterator to the next position, returning the given default value
instead of throwing an exception if the iterator has no more entries.
Arguments:
Returns:
*
The next item in the iteration, or defaultValue if the iterator was empty.
|
code » | |||||
|
Cartesian product of zero or more sets. Gives an iterator that gives every
combination of one element chosen from each set. For example,
([1, 2], [3, 4]) gives ([1, 3], [1, 4], [2, 3], [2, 4]).
Arguments:
Returns:
An iterator that gives each n-tuple (as an array).
|
code » | |||||
|
Creates a new iterator that returns the values in a range. This function
can take 1, 2 or 3 arguments:
range(5) same as range(0, 5, 1) range(2, 5) same as range(2, 5, 1)
Arguments:
Returns:
A new iterator that returns the values in the range.
|
code » | |||||
goog.iter.reduce(iterable, f, val, opt_obj)
⇒ *
Passes every element of an iterator into a function and accumulates the
result.
Arguments:
Returns:
*
Result of evaluating f repeatedly across the values of the iterator.
|
code » | |||||
|
Goes through the values in the iterator. Calls f for each these and if any of
them returns true, this returns true (without checking the rest). If all
return false this will return false.
Arguments:
Returns:
true if any value passes the test.
|
code » | |||||
|
Builds a new iterator that iterates over the original, but only as long as a
supplied function returns true.
Arguments:
Returns:
A new iterator that keeps elements in the original iterator as long as the function is true.
|
code » | |||||
|
Converts the iterator to an array
Arguments:
Returns:
An array of the elements the iterator iterates over.
|
code » | |||||
|
Returns an iterator that knows how to iterate over the values in the object.
Arguments:
Returns:
An iterator that knows how to iterate over the values in
iterable.
|
code » |
goog.iter.StopIteration
: (Error | null)
Singleton Error object that is used to terminate iterations.
|
Code » |