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

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

package com.annimon.stream.operator;

import com.annimon.stream.function.BiFunction;
import com.annimon.stream.iterator.LsaIterator;
import java.util.Iterator;

public class ObjZip extends LsaIterator {

    private final Iterator iterator1;
    private final Iterator iterator2;
    private final BiFunction combiner;

    public ObjZip(Iterator iterator1, Iterator iterator2,
            BiFunction combiner) {
        this.iterator1 = iterator1;
        this.iterator2 = iterator2;
        this.combiner = combiner;
    }

    @Override
    public boolean hasNext() {
        return iterator1.hasNext() && iterator2.hasNext();
    }

    @Override
    public R nextIteration() {
        return combiner.apply(iterator1.next(), iterator2.next());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy