fr.lirmm.graphik.util.stream.StreamAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of integraal-graal-ruleset-analysis Show documentation
Show all versions of integraal-graal-ruleset-analysis Show documentation
Rule base analysis for InteGraal. This is imported from Graal
package fr.lirmm.graphik.util.stream;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Optional;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.BinaryOperator;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.IntFunction;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.function.ToDoubleFunction;
import java.util.function.ToIntFunction;
import java.util.function.ToLongFunction;
import java.util.stream.Collector;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class StreamAdapter implements Stream {
AutoCloseable toClose = null;
Stream stream;
public StreamAdapter(CloseableIterator iterator) {
super();
this.toClose = iterator;
Spliterator spitr = Spliterators.spliteratorUnknownSize(
new IteratorAdapter(iterator), Spliterator.NONNULL);
stream = StreamSupport.stream(spitr, false);
}
public StreamAdapter(Iterator iterator) {
super();
if (iterator instanceof AutoCloseable) {
this.toClose = (AutoCloseable)iterator;
}
Spliterator spitr = Spliterators.spliteratorUnknownSize(
iterator, Spliterator.NONNULL);
stream = StreamSupport.stream(spitr, false);
}
public boolean allMatch(Predicate super T> arg0) {
return stream.allMatch(arg0);
}
public boolean anyMatch(Predicate super T> arg0) {
return stream.anyMatch(arg0);
}
public void close() {
if (toClose != null) {
try {
toClose.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
stream.close();
}
public R collect(Collector super T, A, R> arg0) {
return stream.collect(arg0);
}
public R collect(Supplier arg0, BiConsumer arg1, BiConsumer arg2) {
return stream.collect(arg0, arg1, arg2);
}
public long count() {
return stream.count();
}
public Stream distinct() {
return stream.distinct();
}
public Stream filter(Predicate super T> arg0) {
return stream.filter(arg0);
}
public Optional findAny() {
return stream.findAny();
}
public Optional findFirst() {
return stream.findFirst();
}
public Stream flatMap(Function super T, ? extends Stream extends R>> arg0) {
return stream.flatMap(arg0);
}
public DoubleStream flatMapToDouble(Function super T, ? extends DoubleStream> arg0) {
return stream.flatMapToDouble(arg0);
}
public IntStream flatMapToInt(Function super T, ? extends IntStream> arg0) {
return stream.flatMapToInt(arg0);
}
public LongStream flatMapToLong(Function super T, ? extends LongStream> arg0) {
return stream.flatMapToLong(arg0);
}
public void forEach(Consumer super T> arg0) {
stream.forEach(arg0);
}
public void forEachOrdered(Consumer super T> arg0) {
stream.forEachOrdered(arg0);
}
public boolean isParallel() {
return stream.isParallel();
}
public Iterator iterator() {
return stream.iterator();
}
public Stream limit(long arg0) {
return stream.limit(arg0);
}
public Stream map(Function super T, ? extends R> arg0) {
return stream.map(arg0);
}
public DoubleStream mapToDouble(ToDoubleFunction super T> arg0) {
return stream.mapToDouble(arg0);
}
public IntStream mapToInt(ToIntFunction super T> arg0) {
return stream.mapToInt(arg0);
}
public LongStream mapToLong(ToLongFunction super T> arg0) {
return stream.mapToLong(arg0);
}
public Optional max(Comparator super T> arg0) {
return stream.max(arg0);
}
public Optional min(Comparator super T> arg0) {
return stream.min(arg0);
}
public boolean noneMatch(Predicate super T> arg0) {
return stream.noneMatch(arg0);
}
public Stream onClose(Runnable arg0) {
return stream.onClose(arg0);
}
public Stream parallel() {
return stream.parallel();
}
public Stream peek(Consumer super T> arg0) {
return stream.peek(arg0);
}
public Optional reduce(BinaryOperator arg0) {
return stream.reduce(arg0);
}
public T reduce(T arg0, BinaryOperator arg1) {
return stream.reduce(arg0, arg1);
}
public U reduce(U arg0, BiFunction arg1, BinaryOperator arg2) {
return stream.reduce(arg0, arg1, arg2);
}
public Stream sequential() {
return stream.sequential();
}
public Stream skip(long arg0) {
return stream.skip(arg0);
}
public Stream sorted() {
return stream.sorted();
}
public Stream sorted(Comparator super T> arg0) {
return stream.sorted(arg0);
}
public Spliterator spliterator() {
return stream.spliterator();
}
public Object[] toArray() {
return stream.toArray();
}
public A[] toArray(IntFunction arg0) {
return stream.toArray(arg0);
}
public Stream unordered() {
return stream.unordered();
}
}