com.davfx.ninio.http.UnionIterable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ninio Show documentation
Show all versions of ninio Show documentation
A Java NIO HTTP client/server as light as possible
package com.davfx.ninio.http;
import java.util.Iterator;
public final class UnionIterable implements Iterable {
private final Iterable i;
private final Iterable j;
public UnionIterable(Iterable i, Iterable j) {
this.i = i;
this.j = j;
}
@Override
public Iterator iterator() {
final Iterator ii = i.iterator();
final Iterator ji = j.iterator();
return new Iterator() {
@Override
public boolean hasNext() {
return ii.hasNext() || ji.hasNext();
}
@Override
public T next() {
if (ii.hasNext()) {
return ii.next();
}
return ji.next();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy