Package org.hibernate.query.spi
Class StreamDecorator<R>
- java.lang.Object
-
- org.hibernate.query.spi.StreamDecorator<R>
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.util.stream.BaseStream<R,java.util.stream.Stream<R>>,java.util.stream.Stream<R>
public class StreamDecorator<R> extends java.lang.Object implements java.util.stream.Stream<R>TheStreamDecoratorwraps a JavaStreamand registers acloseHandlerwhich is passed further to any resultingStream. The goal of theStreamDecoratoris to close the underlyingStreamupon calling a terminal operation.- Since:
- 5.4
-
-
Constructor Summary
Constructors Constructor Description StreamDecorator(java.util.stream.Stream<R> delegate, java.lang.Runnable closeHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallMatch(java.util.function.Predicate<? super R> predicate)booleananyMatch(java.util.function.Predicate<? super R> predicate)voidclose()<R1> R1collect(java.util.function.Supplier<R1> supplier, java.util.function.BiConsumer<R1,? super R> accumulator, java.util.function.BiConsumer<R1,R1> combiner)<R1,A>
R1collect(java.util.stream.Collector<? super R,A,R1> collector)longcount()java.util.stream.Stream<R>distinct()java.util.stream.Stream<R>dropWhile(java.util.function.Predicate<? super R> predicate)java.util.stream.Stream<R>filter(java.util.function.Predicate<? super R> predicate)java.util.Optional<R>findAny()java.util.Optional<R>findFirst()<R1> java.util.stream.Stream<R1>flatMap(java.util.function.Function<? super R,? extends java.util.stream.Stream<? extends R1>> mapper)java.util.stream.DoubleStreamflatMapToDouble(java.util.function.Function<? super R,? extends java.util.stream.DoubleStream> mapper)java.util.stream.IntStreamflatMapToInt(java.util.function.Function<? super R,? extends java.util.stream.IntStream> mapper)java.util.stream.LongStreamflatMapToLong(java.util.function.Function<? super R,? extends java.util.stream.LongStream> mapper)voidforEach(java.util.function.Consumer<? super R> action)voidforEachOrdered(java.util.function.Consumer<? super R> action)booleanisParallel()java.util.Iterator<R>iterator()java.util.stream.Stream<R>limit(long maxSize)<R1> java.util.stream.Stream<R1>map(java.util.function.Function<? super R,? extends R1> mapper)java.util.stream.DoubleStreammapToDouble(java.util.function.ToDoubleFunction<? super R> mapper)java.util.stream.IntStreammapToInt(java.util.function.ToIntFunction<? super R> mapper)java.util.stream.LongStreammapToLong(java.util.function.ToLongFunction<? super R> mapper)java.util.Optional<R>max(java.util.Comparator<? super R> comparator)java.util.Optional<R>min(java.util.Comparator<? super R> comparator)booleannoneMatch(java.util.function.Predicate<? super R> predicate)java.util.stream.Stream<R>onClose(java.lang.Runnable closeHandler)java.util.stream.Stream<R>parallel()java.util.stream.Stream<R>peek(java.util.function.Consumer<? super R> action)java.util.Optional<R>reduce(java.util.function.BinaryOperator<R> accumulator)Rreduce(R identity, java.util.function.BinaryOperator<R> accumulator)<U> Ureduce(U identity, java.util.function.BiFunction<U,? super R,U> accumulator, java.util.function.BinaryOperator<U> combiner)java.util.stream.Stream<R>sequential()java.util.stream.Stream<R>skip(long n)java.util.stream.Stream<R>sorted()java.util.stream.Stream<R>sorted(java.util.Comparator<? super R> comparator)java.util.Spliterator<R>spliterator()java.util.stream.Stream<R>takeWhile(java.util.function.Predicate<? super R> predicate)java.lang.Object[]toArray()<A> A[]toArray(java.util.function.IntFunction<A[]> generator)java.util.stream.Stream<R>unordered()
-
-
-
Constructor Detail
-
StreamDecorator
public StreamDecorator(java.util.stream.Stream<R> delegate, java.lang.Runnable closeHandler)
-
-
Method Detail
-
filter
public java.util.stream.Stream<R> filter(java.util.function.Predicate<? super R> predicate)
- Specified by:
filterin interfacejava.util.stream.Stream<R>
-
map
public <R1> java.util.stream.Stream<R1> map(java.util.function.Function<? super R,? extends R1> mapper)
- Specified by:
mapin interfacejava.util.stream.Stream<R>
-
mapToInt
public java.util.stream.IntStream mapToInt(java.util.function.ToIntFunction<? super R> mapper)
- Specified by:
mapToIntin interfacejava.util.stream.Stream<R>
-
mapToLong
public java.util.stream.LongStream mapToLong(java.util.function.ToLongFunction<? super R> mapper)
- Specified by:
mapToLongin interfacejava.util.stream.Stream<R>
-
mapToDouble
public java.util.stream.DoubleStream mapToDouble(java.util.function.ToDoubleFunction<? super R> mapper)
- Specified by:
mapToDoublein interfacejava.util.stream.Stream<R>
-
flatMap
public <R1> java.util.stream.Stream<R1> flatMap(java.util.function.Function<? super R,? extends java.util.stream.Stream<? extends R1>> mapper)
- Specified by:
flatMapin interfacejava.util.stream.Stream<R>
-
flatMapToInt
public java.util.stream.IntStream flatMapToInt(java.util.function.Function<? super R,? extends java.util.stream.IntStream> mapper)
- Specified by:
flatMapToIntin interfacejava.util.stream.Stream<R>
-
flatMapToLong
public java.util.stream.LongStream flatMapToLong(java.util.function.Function<? super R,? extends java.util.stream.LongStream> mapper)
- Specified by:
flatMapToLongin interfacejava.util.stream.Stream<R>
-
flatMapToDouble
public java.util.stream.DoubleStream flatMapToDouble(java.util.function.Function<? super R,? extends java.util.stream.DoubleStream> mapper)
- Specified by:
flatMapToDoublein interfacejava.util.stream.Stream<R>
-
distinct
public java.util.stream.Stream<R> distinct()
- Specified by:
distinctin interfacejava.util.stream.Stream<R>
-
sorted
public java.util.stream.Stream<R> sorted()
- Specified by:
sortedin interfacejava.util.stream.Stream<R>
-
sorted
public java.util.stream.Stream<R> sorted(java.util.Comparator<? super R> comparator)
- Specified by:
sortedin interfacejava.util.stream.Stream<R>
-
peek
public java.util.stream.Stream<R> peek(java.util.function.Consumer<? super R> action)
- Specified by:
peekin interfacejava.util.stream.Stream<R>
-
limit
public java.util.stream.Stream<R> limit(long maxSize)
- Specified by:
limitin interfacejava.util.stream.Stream<R>
-
skip
public java.util.stream.Stream<R> skip(long n)
- Specified by:
skipin interfacejava.util.stream.Stream<R>
-
forEach
public void forEach(java.util.function.Consumer<? super R> action)
- Specified by:
forEachin interfacejava.util.stream.Stream<R>
-
forEachOrdered
public void forEachOrdered(java.util.function.Consumer<? super R> action)
- Specified by:
forEachOrderedin interfacejava.util.stream.Stream<R>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArrayin interfacejava.util.stream.Stream<R>
-
toArray
public <A> A[] toArray(java.util.function.IntFunction<A[]> generator)
- Specified by:
toArrayin interfacejava.util.stream.Stream<R>
-
reduce
public R reduce(R identity, java.util.function.BinaryOperator<R> accumulator)
- Specified by:
reducein interfacejava.util.stream.Stream<R>
-
reduce
public java.util.Optional<R> reduce(java.util.function.BinaryOperator<R> accumulator)
- Specified by:
reducein interfacejava.util.stream.Stream<R>
-
reduce
public <U> U reduce(U identity, java.util.function.BiFunction<U,? super R,U> accumulator, java.util.function.BinaryOperator<U> combiner)- Specified by:
reducein interfacejava.util.stream.Stream<R>
-
collect
public <R1> R1 collect(java.util.function.Supplier<R1> supplier, java.util.function.BiConsumer<R1,? super R> accumulator, java.util.function.BiConsumer<R1,R1> combiner)- Specified by:
collectin interfacejava.util.stream.Stream<R>
-
collect
public <R1,A> R1 collect(java.util.stream.Collector<? super R,A,R1> collector)
- Specified by:
collectin interfacejava.util.stream.Stream<R>
-
min
public java.util.Optional<R> min(java.util.Comparator<? super R> comparator)
- Specified by:
minin interfacejava.util.stream.Stream<R>
-
max
public java.util.Optional<R> max(java.util.Comparator<? super R> comparator)
- Specified by:
maxin interfacejava.util.stream.Stream<R>
-
count
public long count()
- Specified by:
countin interfacejava.util.stream.Stream<R>
-
anyMatch
public boolean anyMatch(java.util.function.Predicate<? super R> predicate)
- Specified by:
anyMatchin interfacejava.util.stream.Stream<R>
-
allMatch
public boolean allMatch(java.util.function.Predicate<? super R> predicate)
- Specified by:
allMatchin interfacejava.util.stream.Stream<R>
-
noneMatch
public boolean noneMatch(java.util.function.Predicate<? super R> predicate)
- Specified by:
noneMatchin interfacejava.util.stream.Stream<R>
-
findFirst
public java.util.Optional<R> findFirst()
- Specified by:
findFirstin interfacejava.util.stream.Stream<R>
-
findAny
public java.util.Optional<R> findAny()
- Specified by:
findAnyin interfacejava.util.stream.Stream<R>
-
iterator
public java.util.Iterator<R> iterator()
-
spliterator
public java.util.Spliterator<R> spliterator()
-
isParallel
public boolean isParallel()
-
sequential
public java.util.stream.Stream<R> sequential()
-
parallel
public java.util.stream.Stream<R> parallel()
-
unordered
public java.util.stream.Stream<R> unordered()
-
onClose
public java.util.stream.Stream<R> onClose(java.lang.Runnable closeHandler)
-
close
public void close()
-
takeWhile
public java.util.stream.Stream<R> takeWhile(java.util.function.Predicate<? super R> predicate)
- Specified by:
takeWhilein interfacejava.util.stream.Stream<R>
-
-