org.apache.cassandra.utils
Class ReducingIterator<T>
java.lang.Object
com.google.common.collect.UnmodifiableIterator<T>
com.google.common.collect.AbstractIterator<T>
org.apache.cassandra.utils.ReducingIterator<T>
- All Implemented Interfaces:
- java.lang.Iterable<T>, java.util.Iterator<T>
public abstract class ReducingIterator<T>
- extends com.google.common.collect.AbstractIterator<T>
- implements java.util.Iterator<T>, java.lang.Iterable<T>
reduces equal values from the source iterator to a single (optionally transformed) instance.
Field Summary |
protected T |
last
|
protected java.util.Iterator<T> |
source
|
Method Summary |
protected T |
computeNext()
|
protected abstract T |
getReduced()
return the last object computed by reduce |
protected boolean |
isEqual(T o1,
T o2)
override this if the keys you want to base the reduce on are not the same as the object itself (but can be generated from it) |
java.util.Iterator<T> |
iterator()
|
abstract void |
reduce(T current)
combine this object with the previous ones. |
Methods inherited from class com.google.common.collect.AbstractIterator |
endOfData, hasNext, next, peek |
Methods inherited from class com.google.common.collect.UnmodifiableIterator |
remove |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Iterator |
hasNext, next, remove |
source
protected java.util.Iterator<T> source
last
protected T last
ReducingIterator
public ReducingIterator(java.util.Iterator<T> source)
reduce
public abstract void reduce(T current)
- combine this object with the previous ones. intermediate state is up to your implementation.
getReduced
protected abstract T getReduced()
- return the last object computed by reduce
isEqual
protected boolean isEqual(T o1,
T o2)
- override this if the keys you want to base the reduce on are not the same as the object itself (but can be generated from it)
computeNext
protected T computeNext()
- Specified by:
computeNext
in class com.google.common.collect.AbstractIterator<T>
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interface java.lang.Iterable<T>
Copyright © 2009 The Apache Software Foundation