Class PaginedStream<T>
java.lang.Object
org.apache.sis.internal.stream.BaseStreamWrapper<T, Stream<T>>
org.apache.sis.internal.stream.StreamWrapper<T>
org.apache.sis.internal.stream.PaginedStream<T>
- Type Parameters:
T- the type of objects contained in the stream, as specified inStreaminterface.
- All Implemented Interfaces:
AutoCloseable, BaseStream<T, Stream<T>>, Stream<T>
A stream on which
skip and limit operations are delegated to a root stream.
This is useful when the root stream is capable of some optimizations, for example using SQL.
The redirection stops as soon as an operation may change the elements order or filtering.- Since:
- 1.1
- Version:
- 1.1
-
Nested Class Summary
Nested classes/interfaces inherited from interface Stream
Stream.Builder<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stream<?> The root stream on which to delegateskipandlimitoperations.Fields inherited from class StreamWrapper
sourceFields inherited from class BaseStreamWrapper
toClose -
Constructor Summary
ConstructorsConstructorDescriptionPaginedStream(Stream<T> source, Stream<?> root) Creates a new mapped stream. -
Method Summary
Modifier and TypeMethodDescriptionlongcount()Returns the number of elements in this stream.distinct()Returns a stream with distinct elements of this stream.Returns a stream with elements of this stream that match the given predicate.limit(long maxSize) Truncates this stream to the given number of elements.mapToDouble(ToDoubleFunction<? super T> mapper) Returns a stream with results of applying the given function to the elements of this stream.skip(long n) Discards the specified number of elements.sorted()Returns a stream with elements of this stream sorted in natural order.sorted(Comparator<? super T> comparator) Returns a stream with elements of this stream sorted using the given comparator.Returns an equivalent stream that is unordered.Methods inherited from class StreamWrapper
allMatch, anyMatch, collect, collect, delegate, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, iterator, map, mapToInt, mapToLong, max, min, noneMatch, onClose, parallel, peek, reduce, reduce, reduce, sequential, source, spliterator, toArray, toArrayMethods inherited from class BaseStreamWrapper
close, inactive, isParallelMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BaseStream
close, isParallel
-
Field Details
-
root
The root stream on which to delegateskipandlimitoperations.
-
-
Constructor Details
-
PaginedStream
-
-
Method Details
-
skip
-
limit
-
count
-
mapToDouble
Returns a stream with results of applying the given function to the elements of this stream.- Specified by:
mapToDoublein interfaceStream<T>- Overrides:
mapToDoublein classStreamWrapper<T>- Parameters:
mapper- function to apply to each element.- Returns:
- the new stream.
-
distinct
Description copied from class:StreamWrapperReturns a stream with distinct elements of this stream. -
unordered
Description copied from class:StreamWrapperReturns an equivalent stream that is unordered.- Specified by:
unorderedin interfaceBaseStream<T, Stream<T>>- Overrides:
unorderedin classStreamWrapper<T>
-
sorted
Description copied from class:StreamWrapperReturns a stream with elements of this stream sorted in natural order. -
sorted
Description copied from class:StreamWrapperReturns a stream with elements of this stream sorted using the given comparator. -
filter
-