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.
Creates an iterator that returns running totals from the numbers in
iterable . For example, the array [1, 2, 3, 4, 5] yields
1 -> 3 -> 6 -> 10 -> 15 .
Arguments:
|
code » | |||||
![]()
No description.
|
code » | |||||
Takes zero or more iterables and returns one iterator that will iterate over
them in the order chained.
Arguments:
Returns: !goog.iter.Iterator.<VALUE>
Returns a new iterator that will
iterate over all the given iterables' contents.
|
code » | |||||
Takes a single iterable containing zero or more iterables and returns one
iterator that will iterate over each one in the order given.
Arguments:
Returns: !goog.iter.Iterator.<VALUE>
Returns a new iterator that will
iterate over all the contents of the iterables contained within
iterable .
|
code » | |||||
Creates an iterator that returns combinations of elements from
iterable .
Combinations are obtained by taking the of
iterable and filtering those whose elements appear in the order they
are encountered in iterable . For example, the 3-length combinations
of [0,1,2,3] are [[0,1,2], [0,1,3], [0,2,3], [1,2,3]] .
Arguments:
Returns: !goog.iter.Iterator.<!Array.<VALUE>>
A new iterator containing
combinations from the
iterable .
|
code » | |||||
Creates an iterator that returns combinations of elements from
iterable , with repeated elements possible.
Combinations are obtained by taking the Cartesian product of length
iterables and filtering those whose elements appear in the order they are
encountered in iterable . For example, the 2-length combinations of
[1,2,3] are [[1,1], [1,2], [1,3], [2,2], [2,3], [3,3]] .
Arguments:
Returns: !goog.iter.Iterator.<!Array.<VALUE>>
A new iterator containing
combinations from the
iterable .
|
code » | |||||
Creates an iterator that filters
iterable based on a series of
selectors . On each call to next() , one item is taken from
both the iterable and selectors iterators. If the item from
selectors evaluates to true, the item from iterable is given.
Otherwise, it is skipped. Once either iterable or selectors
is exhausted, subsequent calls to next() will throw
goog.iter.StopIteration .
Arguments:
|
code » | |||||
Creates an iterator that is advanced
count steps ahead. Consumed
values are silently discarded. If count is greater than the number
of elements in iterable , an empty iterator is returned. Subsequent
calls to next() will throw goog.iter.StopIteration .
Arguments:
|
code » | |||||
Creates an iterator that counts indefinitely from a starting value.
Arguments:
|
code » | |||||
![]()
No description.
|
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: !goog.iter.Iterator.<VALUE>
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: !goog.iter.Iterator.<VALUE>
A new iterator that drops elements from
the original iterator as long as
f is true.
|
code » | |||||
Creates an iterator that returns arrays containing a count and an element
obtained from the given
iterable .
Arguments:
|
code » | |||||
Iterates over two iterables and returns true if they contain the same
sequence of elements and have the same length.
Arguments:
Returns: boolean
true if the iterables contain the same sequence of elements
and have the same length.
|
code » | |||||
Goes through the values in the iterator. Calls f for each of 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: boolean
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: !goog.iter.Iterator.<VALUE>
A new iterator in which only elements
that passed the test are present.
|
code » | |||||
Calls a function for every element in the iterator, and if the function
returns false adds the element to a new iterator.
Arguments:
Returns: !goog.iter.Iterator.<VALUE>
A new iterator in which only elements
that did not pass the test are present.
|
code » | |||||
![]()
Calls a function for each element in the iterator with the element of the
iterator passed as argument.
Arguments:
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
No description.
|
code » | |||||
Creates an iterator that returns arrays containing elements from the
iterable grouped by a key value. For iterables with repeated
elements (i.e. sorted according to a particular key function), this function
has a uniq -like effect. For example, grouping the array:
[A, B, B, C, C, A] produces
[A, [A]], [B, [B, B]], [C, [C, C]], [A, [A]] .
Arguments:
Returns: !goog.iter.Iterator.<!Array>
A new iterator that returns arrays of
consecutive key and groups.
|
code » | |||||
Checks an array for duplicate elements.
|
code » | |||||
Joins the values in a iterator with a delimiter.
Arguments:
Returns: string
The joined value string.
|
code » | |||||
Creates an iterator that returns the first
limitSize elements from an
iterable. If this number is greater than the number of elements in the
iterable, all the elements are returned.
Arguments:
|
code » | |||||
For every element in the iterator call a function and return a new iterator
with that value.
Arguments:
Returns: !goog.iter.Iterator.<RESULT>
A new iterator that returns the
results of applying the function to each element in the original
iterator.
|
code » | |||||
![]()
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: VALUE
The next item in the iteration, or defaultValue if the
iterator was empty.
|
code » | |||||
Creates an iterator that returns permutations of elements in
iterable .
Permutations are obtained by taking the Cartesian product of
opt_length iterables and filtering out those with repeated
elements. For example, the permutations of [1,2,3] are
[[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]] .
Arguments:
Returns: !goog.iter.Iterator.<!Array.<VALUE>>
A new iterator containing the
permutations of
iterable .
|
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:
|
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:
|
code » | |||||
![]()
Passes every element of an iterator into a function and accumulates the
result.
Arguments:
Returns: VALUE
Result of evaluating f repeatedly across the values of
the iterator.
|
code » | |||||
Creates an iterator that returns the same object or value repeatedly.
Arguments:
|
code » | |||||
Creates an iterator that returns a range of elements from an iterable.
Similar to but does not support negative indexes.
Arguments:
|
code » | |||||
Goes through the values in the iterator. Calls f for each of 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: boolean
true if any value passes the test.
|
code » | |||||
Gives an iterator that gives the result of calling the given function
f with the arguments taken from the next element from
iterable (the elements are expected to also be iterables).
Similar to but allows the function to accept multiple
arguments from the iterable.
Arguments:
Returns: !goog.iter.Iterator.<RESULT>
A new iterator that returns the
results of applying the function to each element in the original
iterator.
|
code » | |||||
Builds a new iterator that iterates over the original, but only as long as a
supplied function returns true.
Arguments:
Returns: !goog.iter.Iterator.<VALUE>
A new iterator that keeps elements in
the original iterator as long as the function is true.
|
code » | |||||
Returns an array of iterators each of which can iterate over the values in
iterable without advancing the others.
Arguments:
|
code » | |||||
Converts the iterator to an array
Arguments:
|
code » | |||||
Returns an iterator that knows how to iterate over the values in the object.
Arguments:
Returns: !goog.iter.Iterator.<VALUE>
An iterator that knows how to iterate
over the values in
iterable .
|
code » | |||||
Creates an iterator that returns arrays containing the ith elements from the
provided iterables. The returned arrays will be the same size as the number
of iterables given in
var_args . Once the shortest iterable is
exhausted, subsequent calls to next() will throw
goog.iter.StopIteration .
Arguments:
Returns: !goog.iter.Iterator.<!Array.<VALUE>>
A new iterator that returns
arrays of elements from the provided iterables.
|
code » | |||||
Creates an iterator that returns arrays containing the ith elements from the
provided iterables. The returned arrays will be the same size as the number
of iterables given in
var_args . Shorter iterables will be extended
with fillValue . Once the longest iterable is exhausted, subsequent
calls to next() will throw goog.iter.StopIteration .
Arguments:
Returns: !goog.iter.Iterator.<!Array.<VALUE>>
A new iterator that returns
arrays of elements from the provided iterables.
|
code » |