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

com.natpryce.makeiteasy.sequence.ElementsSequence Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
package com.natpryce.makeiteasy.sequence;

import com.natpryce.makeiteasy.Donor;

import java.util.Iterator;

public class ElementsSequence implements Donor {
    private final Iterable nextElements;
    private Iterator current;

    public ElementsSequence(Iterable firstElements, Iterable nextElements) {
        this.nextElements = nextElements;
        this.current = firstElements.iterator();
    }

    @Override
    public T value() {
        if (!current.hasNext()) {
            current = nextElements.iterator();
        }

        return current.next();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy