Example #1
0
  @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);
  }
Example #2
0
  public T next() throws SuspendExecution {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }

    counter++;
    return wrapped.next();
  }
Example #3
0
 public boolean hasNext() throws SuspendExecution {
   return counter < loopLimit && wrapped.hasNext();
 }