All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.annimon.stream.operator.ObjScan Maven / Gradle / Ivy

The newest version!
package com.annimon.stream.operator;

import com.landawn.abacus.util.function.BiFunction;
import com.annimon.stream.iterator.LsaExtIterator;
import java.util.Iterator;

public class ObjScan extends LsaExtIterator {

    private final Iterator iterator;
    private final BiFunction accumulator;

    public ObjScan(Iterator iterator, BiFunction accumulator) {
        this.iterator = iterator;
        this.accumulator = accumulator;
    }

    @Override
    protected void nextIteration() {
        hasNext = iterator.hasNext();
        if (hasNext) {
            final T value = iterator.next();
            if (isInit) {
                next = accumulator.apply(next, value);
            } else {
                next = value;
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy