Package org.hibernate.query.spi
Class StreamDecorator<R>
- java.lang.Object
-
- org.hibernate.query.spi.StreamDecorator<R>
-
- All Implemented Interfaces:
AutoCloseable,BaseStream<R,Stream<R>>,Stream<R>
public class StreamDecorator<R> extends Object implements 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.stream.Stream
Stream.Builder<T extends Object>
-
-
Constructor Summary
Constructors Constructor Description StreamDecorator(Stream<R> delegate, Runnable closeHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallMatch(Predicate<? super R> predicate)booleananyMatch(Predicate<? super R> predicate)voidclose()<R1> R1collect(Supplier<R1> supplier, BiConsumer<R1,? super R> accumulator, BiConsumer<R1,R1> combiner)<R1,A>
R1collect(Collector<? super R,A,R1> collector)longcount()Stream<R>distinct()Stream<R>dropWhile(Predicate<? super R> predicate)Stream<R>filter(Predicate<? super R> predicate)Optional<R>findAny()Optional<R>findFirst()<R1> Stream<R1>flatMap(Function<? super R,? extends Stream<? extends R1>> mapper)DoubleStreamflatMapToDouble(Function<? super R,? extends DoubleStream> mapper)IntStreamflatMapToInt(Function<? super R,? extends IntStream> mapper)LongStreamflatMapToLong(Function<? super R,? extends LongStream> mapper)voidforEach(Consumer<? super R> action)voidforEachOrdered(Consumer<? super R> action)booleanisParallel()Iterator<R>iterator()Stream<R>limit(long maxSize)<R1> Stream<R1>map(Function<? super R,? extends R1> mapper)DoubleStreammapToDouble(ToDoubleFunction<? super R> mapper)IntStreammapToInt(ToIntFunction<? super R> mapper)LongStreammapToLong(ToLongFunction<? super R> mapper)Optional<R>max(Comparator<? super R> comparator)Optional<R>min(Comparator<? super R> comparator)booleannoneMatch(Predicate<? super R> predicate)Stream<R>onClose(Runnable closeHandler)Stream<R>parallel()Stream<R>peek(Consumer<? super R> action)Optional<R>reduce(BinaryOperator<R> accumulator)Rreduce(R identity, BinaryOperator<R> accumulator)<U> Ureduce(U identity, BiFunction<U,? super R,U> accumulator, BinaryOperator<U> combiner)Stream<R>sequential()Stream<R>skip(long n)Stream<R>sorted()Stream<R>sorted(Comparator<? super R> comparator)Spliterator<R>spliterator()Stream<R>takeWhile(Predicate<? super R> predicate)Object[]toArray()<A> A[]toArray(IntFunction<A[]> generator)Stream<R>unordered()
-
-
-
Method Detail
-
mapToInt
public IntStream mapToInt(ToIntFunction<? super R> mapper)
-
mapToLong
public LongStream mapToLong(ToLongFunction<? super R> mapper)
-
mapToDouble
public DoubleStream mapToDouble(ToDoubleFunction<? super R> mapper)
- Specified by:
mapToDoublein interfaceStream<R>
-
flatMapToInt
public IntStream flatMapToInt(Function<? super R,? extends IntStream> mapper)
- Specified by:
flatMapToIntin interfaceStream<R>
-
flatMapToLong
public LongStream flatMapToLong(Function<? super R,? extends LongStream> mapper)
- Specified by:
flatMapToLongin interfaceStream<R>
-
flatMapToDouble
public DoubleStream flatMapToDouble(Function<? super R,? extends DoubleStream> mapper)
- Specified by:
flatMapToDoublein interfaceStream<R>
-
sorted
public Stream<R> sorted(Comparator<? super R> comparator)
-
forEachOrdered
public void forEachOrdered(Consumer<? super R> action)
- Specified by:
forEachOrderedin interfaceStream<R>
-
toArray
public <A> A[] toArray(IntFunction<A[]> generator)
-
reduce
public R reduce(R identity, BinaryOperator<R> accumulator)
-
reduce
public Optional<R> reduce(BinaryOperator<R> accumulator)
-
reduce
public <U> U reduce(U identity, BiFunction<U,? super R,U> accumulator, BinaryOperator<U> combiner)
-
collect
public <R1> R1 collect(Supplier<R1> supplier, BiConsumer<R1,? super R> accumulator, BiConsumer<R1,R1> combiner)
-
min
public Optional<R> min(Comparator<? super R> comparator)
-
max
public Optional<R> max(Comparator<? super R> comparator)
-
spliterator
public Spliterator<R> spliterator()
- Specified by:
spliteratorin interfaceBaseStream<R,Stream<R>>
-
isParallel
public boolean isParallel()
- Specified by:
isParallelin interfaceBaseStream<R,Stream<R>>
-
sequential
public Stream<R> sequential()
- Specified by:
sequentialin interfaceBaseStream<R,Stream<R>>
-
unordered
public Stream<R> unordered()
- Specified by:
unorderedin interfaceBaseStream<R,Stream<R>>
-
onClose
public Stream<R> onClose(Runnable closeHandler)
- Specified by:
onClosein interfaceBaseStream<R,Stream<R>>
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBaseStream<R,Stream<R>>
-
-