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, DoubleStream.DoubleMapMultiConsumer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stream<?>
The root stream on which to delegateskip
andlimit
operations.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 TypeMethodDescriptionlong
count()
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, toArray
Methods inherited from class org.apache.sis.internal.stream.BaseStreamWrapper
close, inactive, isParallel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.stream.BaseStream
close, isParallel
Methods inherited from interface java.util.stream.DoubleStream
dropWhile, mapMulti, takeWhile
-
Field Details
-
root
The root stream on which to delegateskip
andlimit
operations.
-
-
Constructor Details
-
PaginedDoubleStream
Creates a new mapped stream.- Parameters:
source
- the stream to wrap.root
- the stream on which to delegateskip
andlimit
operations.
-
-
Method Details
-
skip
Discards the specified number of elements. This method delegates the operation to the root stream.- Specified by:
skip
in interfaceDoubleStream
- Overrides:
skip
in 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:
limit
in interfaceDoubleStream
- Overrides:
limit
in 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:
count
in interfaceDoubleStream
- Overrides:
count
in classDoubleStreamWrapper
- Returns:
- number of elements in this stream.
-
map
Description copied from class:DoubleStreamWrapper
Returns a stream with results of applying the given function to the elements of this stream.- Specified by:
map
in interfaceDoubleStream
- Overrides:
map
in classDoubleStreamWrapper
-
distinct
Description copied from class:DoubleStreamWrapper
Returns a stream with distinct elements of this stream.- Specified by:
distinct
in interfaceDoubleStream
- Overrides:
distinct
in classDoubleStreamWrapper
-
unordered
Description copied from class:DoubleStreamWrapper
Returns an equivalent stream that is unordered.- Specified by:
unordered
in interfaceBaseStream<Double,
DoubleStream> - Overrides:
unordered
in classDoubleStreamWrapper
-
sorted
Description copied from class:DoubleStreamWrapper
Returns a stream with elements of this stream sorted in ascending order.- Specified by:
sorted
in interfaceDoubleStream
- Overrides:
sorted
in classDoubleStreamWrapper
-
filter
Description copied from class:DoubleStreamWrapper
Returns a stream with elements of this stream that match the given predicate.- Specified by:
filter
in interfaceDoubleStream
- Overrides:
filter
in classDoubleStreamWrapper
-