@Override protected void reduce_(K key, SuspendableIterator<Long> counters, Context context) throws Exception { long counterSum = 0; while (counters.hasNext()) { counterSum += counters.next(); } emit(key, counterSum); }
public T next() throws SuspendExecution { if (!hasNext()) { throw new NoSuchElementException(); } counter++; return wrapped.next(); }
public boolean hasNext() throws SuspendExecution { return counter < loopLimit && wrapped.hasNext(); }