private void processNext() {
        int combinedSize = this.combineMap.size();
        while (combinedSize < MAX_SIZE && this.inputIterator.hasNext()) {
            final Tuple2<K, V> keyValue = this.inputIterator.next();
            List<V> values = this.combineMap.get(keyValue._1());
            if (null == values) {
                values = new ArrayList<>();
                this.combineMap.put(keyValue._1(), values);
            }
            values.add(keyValue._2());
            combinedSize++;
            this.combined = false;
            if (combinedSize >= MAX_SIZE) {
                this.doCombine();
                combinedSize = this.combineMap.size();
            }
        }
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/CombineIterator.java