iter.GroupByIterator_ Extends goog.iter.Iterator
Implements the goog.iter.groupBy iterator.

Inheritance

Constructor

goog.iter.GroupByIterator_(iterableopt_keyFunc)

Parameters

iterable : !goog.iter.Iterator.<VALUE> | !goog.iter.Iterable
The iterable to group.
opt_keyFunc : function(...[VALUE]): KEY=
Optional function for determining the key value for each group in the iterable. Default is the identity function.

Instance Methods

Public Protected Private
groupItems_(targetKey) !Array.<VALUE>
Performs the grouping of objects using the given key.
Arguments:
targetKey : KEY
The target key object for the group.
Returns: !Array.<VALUE>  An array of grouped objects.
code »
keyFunc()
A function for determining the key value for each element in the iterable. If no function is provided, the identity function is used and returns the element unchanged.
code »
next()
No description.
code »
__iterator__(opt_keys) !goog.iter.Iterator.<VALUE>
Returns the Iterator object itself. This is used to implement the iterator protocol in JavaScript 1.7
Arguments:
opt_keys : boolean=
Whether to return the keys or values. Default is to only return the values. This is being used by the for-in loop (true) and the for-each-in loop (false). Even though the param gives a hint about what the iterator will return there is no guarantee that it will return the keys when true is passed.
Returns: !goog.iter.Iterator.<VALUE>  The object itself.
code »
next() VALUE
Returns the next value of the iteration. This will throw the object when the iteration passes the end.
Returns: VALUE  Any object or value.
code »

Instance Properties

constructor :
No description.
Code »
currentKey :
The current key visited during iteration.
Code »
currentValue :
The current value being added to the group.
Code »
iterator : goog.iter.Iterator
The iterable to group, coerced to an iterator.
Code »
targetKey :
The target key for determining the start of a group.
Code »

Static Properties

goog.iter.GroupByIterator_.superClass_ :
No description.
Code »

Package iter

Package Reference