Class goog.iter.GroupByIterator_.<KEY, VALUE>

code »
goog.iter.Iterator.<Array>
  └ goog.iter.GroupByIterator_

Implements the goog.iter.groupBy iterator.

Constructor

goog.iter.GroupByIterator_ ( iterable, opt_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.
Show:

Instance Methods

Defined in goog.iter.GroupByIterator_

code »groupItems_ ( targetKey )!Array.<VALUE>

Performs the grouping of objects using the given key.

Parameters
targetKey: KEY
The target key object for the group.
Returns
An array of grouped objects.
code »keyFunc ( )KEY

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 ( )Array

Defined in goog.iter.Iterator.<Array>

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

Parameters
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
The object itself.

Instance Properties

Defined in goog.iter.GroupByIterator_

The current key visited during iteration.

The current value being added to the group.

The iterable to group, coerced to an iterator.

The target key for determining the start of a group.

Static Properties