org.daisy.dotify.common.collection.CompoundIterable Maven / Gradle / Ivy
package org.daisy.dotify.common.collection;
import java.util.Iterator;
/**
* Provides a method to iterate over several iterables of the same type
* as if the items were part of the same iterable.
*
* @param the type of iterable
* @author Joel Håkansson
*/
public class CompoundIterable implements Iterable {
private final Iterable extends Iterable> iterables;
/**
* Creates a new compound iterable.
*
* @param iterables the iterables to use
*/
public CompoundIterable(Iterable extends Iterable> iterables) {
this.iterables = iterables;
}
@Override
public Iterator iterator() {
return new CompoundIterator<>(iterables);
}
}