Package org.apache.sis.internal.stream
Class PaginedDoubleStream
java.lang.Object
org.apache.sis.internal.stream.BaseStreamWrapper<Double,DoubleStream>
org.apache.sis.internal.stream.DoubleStreamWrapper
org.apache.sis.internal.stream.PaginedDoubleStream
- All Implemented Interfaces:
AutoCloseable,BaseStream<Double,,DoubleStream> DoubleStream
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 java.util.stream.DoubleStream
DoubleStream.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stream<?>The root stream on which to delegateskipandlimitoperations.Fields inherited from class org.apache.sis.internal.stream.BaseStreamWrapper
toClose -
Constructor Summary
ConstructorsConstructorDescriptionPaginedDoubleStream(DoubleStream 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.filter(DoublePredicate predicate) 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.map(DoubleUnaryOperator 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 ascending order.Returns an equivalent stream that is unordered.Methods inherited from class org.apache.sis.internal.stream.DoubleStreamWrapper
allMatch, anyMatch, average, boxed, collect, delegate, findAny, findFirst, flatMap, forEach, forEachOrdered, iterator, mapToInt, mapToLong, mapToObj, max, min, noneMatch, onClose, parallel, peek, reduce, reduce, sequential, source, spliterator, sum, summaryStatistics, toArrayMethods inherited from class org.apache.sis.internal.stream.BaseStreamWrapper
close, inactive, isParallelMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.stream.BaseStream
close, isParallel
-
Field Details
-
root
The root stream on which to delegateskipandlimitoperations.
-
-
Constructor Details
-
PaginedDoubleStream
Creates a new mapped stream.- Parameters:
source- the stream to wrap.root- the stream on which to delegateskipandlimitoperations.
-
-
Method Details
-
skip
Discards the specified number of elements. This method delegates the operation to the root stream.- Specified by:
skipin interfaceDoubleStream- Overrides:
skipin classDoubleStreamWrapper- Parameters:
n- number of elements to skip.- Returns:
this.
-
limit
Truncates this stream to the given number of elements. This method delegates the operation to the root stream.- Specified by:
limitin interfaceDoubleStream- Overrides:
limitin classDoubleStreamWrapper- Parameters:
maxSize- number of elements to keep.- Returns:
this.
-
count
public long count()Returns the number of elements in this stream. This method delegates the operation to the root stream.- Specified by:
countin interfaceDoubleStream- Overrides:
countin classDoubleStreamWrapper- Returns:
- number of elements in this stream.
-
map
Description copied from class:DoubleStreamWrapperReturns a stream with results of applying the given function to the elements of this stream.- Specified by:
mapin interfaceDoubleStream- Overrides:
mapin classDoubleStreamWrapper
-
distinct
Description copied from class:DoubleStreamWrapperReturns a stream with distinct elements of this stream.- Specified by:
distinctin interfaceDoubleStream- Overrides:
distinctin classDoubleStreamWrapper
-
unordered
Description copied from class:DoubleStreamWrapperReturns an equivalent stream that is unordered.- Specified by:
unorderedin interfaceBaseStream<Double,DoubleStream> - Overrides:
unorderedin classDoubleStreamWrapper
-
sorted
Description copied from class:DoubleStreamWrapperReturns a stream with elements of this stream sorted in ascending order.- Specified by:
sortedin interfaceDoubleStream- Overrides:
sortedin classDoubleStreamWrapper
-
filter
Description copied from class:DoubleStreamWrapperReturns a stream with elements of this stream that match the given predicate.- Specified by:
filterin interfaceDoubleStream- Overrides:
filterin classDoubleStreamWrapper
-