
solid.stream.Merge Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solid Show documentation
Show all versions of solid Show documentation
Solid is an Android library, which provides lightweight data streams and immutable+parcelable collections.
package solid.stream;
import java.util.Iterator;
public class Merge extends Stream {
private Iterable source;
private Iterable with;
public Merge(Iterable source, Iterable with) {
this.source = source;
this.with = with;
}
@Override
public Iterator iterator() {
return new ReadOnlyIterator() {
Iterator sourceI = source.iterator();
Iterator withI = with.iterator();
@Override
public boolean hasNext() {
return sourceI.hasNext() || withI.hasNext();
}
@Override
public T next() {
return sourceI.hasNext() ? sourceI.next() : withI.next();
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy