net.ericaro.neoitertools.generators
Class GroupByGenerator<K,T>
java.lang.Object
net.ericaro.neoitertools.generators.GroupByGenerator<K,T>
- All Implemented Interfaces:
- Generator<Pair<K,Generator<T>>>
public class GroupByGenerator<K,T>
- extends java.lang.Object
- implements Generator<Pair<K,Generator<T>>>
import there is a difference in implementation from the original
python: in Python the generator returned in the Pair is dependent on the
next() state, meaning that when you call next() the generator is no longer
available. In java, Iterator have an extra "hasNext" method that
cannot be implemented without calling the next method, hence, the
python groupBy won't work at all. Therefore we store values in the pair
- Author:
- eric
- See Also:
-
GroupByGenerator's wiki page,
neoitertools site
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GroupByGenerator
public GroupByGenerator(Generator<T> generator,
Lambda<T,K> keyMapper)
next
public Pair<K,Generator<T>> next()
throws java.util.NoSuchElementException
- Specified by:
next in interface Generator<Pair<K,Generator<T>>>
- Returns:
- the next item in the sequence.
- Throws:
java.util.NoSuchElementException - when sequence is exhausted.
Copyright © 2011. All Rights Reserved.