public class DebugDoubleStream extends Object implements DoubleStream, DebuggableStreaming<Double>
DoubleStream
wrapper, which allows overriding of only
two methods to allow seeing stream operation in realtime.DoubleStream.Builder
Modifier | Constructor and Description |
---|---|
protected |
DebugDoubleStream(DoubleStream stream,
boolean outputResults) |
protected DebugDoubleStream(DoubleStream stream, boolean outputResults)
public static DebugDoubleStream of(DoubleStream stream)
DebugDoubleStream
using the default typestream
- The DoubleStream
to wrapDebugDoubleStream
wrapper of the provided DoubleStream
public static DebugDoubleStream of(DoubleStream stream, boolean outputResults)
DebugDoubleStream
using the default typestream
- The DoubleStream
to wrapoutputResults
- true
to output the results of the DoubleStream
as it is operated uponDebugDoubleStream
wrapper of the provided DoubleStream
public static DebugDoubleStream of(DoubleStream stream, Class<? extends DebugDoubleStream> type)
DebugDoubleStream
of the type parameter passed to the method. This is the appropriate
way to instantiate the DebugDoubleStream
, as future caching mechanisms will be in place to optimize this.
You may however expose the constructor if you so choose.stream
- The DoubleStream
to create a DebugDoubleStream
of.type
- The class representing the type of the DebugDoubleStream
to instantiateDebugDoubleStream
of the provided DoubleStream
public static DebugDoubleStream of(DoubleStream stream, boolean outputResults, Class<? extends DebugDoubleStream> type)
DebugDoubleStream
of the type parameter passed to the method. This is the appropriate
way to instantiate the DebugDoubleStream
, as future caching mechanisms will be in place to optimize this.
You may however expose the constructor if you so choose.stream
- The DoubleStream
to create a DebugDoubleStream
of.outputResults
- true
to output the results of the DoubleStream
as it is operated upontype
- The class representing the type of the DebugDoubleStream
to instantiateDebugDoubleStream
of the provided DoubleStream
, or the base class instance of
DebugDoubleStream
if the type either failed to instantiate or was null
.protected <R> R operate(Function<? super DoubleStream,? extends R> action)
DoubleStream
action, and outputs the result as well as
which numerical call it is. For example, the third #filter calll will be printed as
DebugStream#filter[2]: <result>
. The output of result
will be substringed to a maximum
of 50 characters, to keep the console from being spammed with large datasets. Additionally, method names with
differing method parameters will be grouped under the same aliases and therefore, the same method "counter".
DoubleStream
will need to be recreated each time.R
- The return type of the actionaction
- The Function
representing the action taken on the DoubleStream
DoubleStream
protected void operateVoid(Consumer<? super DoubleStream> action)
DoubleStream
action, and outputs the result as well as
which numerical call it is. Due to this being a void operation on a Consumer
, the result output will
always be null
.action
- The Consumer
representing the action taken on the DoubleStream
DebugStream.operate(Function)
public static <D> DebugDoubleStream mapFromObject(DebuggableStreaming<D> debugStream, ToDoubleFunction<? super D> mapper)
public static <D> DebugDoubleStream flatMapFromObject(DebuggableStreaming<D> debugStream, Function<? super D,? extends DoubleStream> mapper)
public DoubleStream filter(DoublePredicate predicate)
filter
in interface DoubleStream
public DoubleStream map(DoubleUnaryOperator mapper)
map
in interface DoubleStream
public <U> Stream<U> mapToObj(DoubleFunction<? extends U> mapper)
mapToObj
in interface DoubleStream
public LongStream mapToLong(DoubleToLongFunction mapper)
mapToLong
in interface DoubleStream
public IntStream mapToInt(DoubleToIntFunction mapper)
mapToInt
in interface DoubleStream
public DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper)
flatMap
in interface DoubleStream
public DoubleStream distinct()
distinct
in interface DoubleStream
public DoubleStream sorted()
sorted
in interface DoubleStream
public DoubleStream peek(DoubleConsumer action)
peek
in interface DoubleStream
public DoubleStream limit(long maxSize)
limit
in interface DoubleStream
public DoubleStream skip(long n)
skip
in interface DoubleStream
public void forEach(DoubleConsumer action)
forEach
in interface DoubleStream
public void forEachOrdered(DoubleConsumer action)
forEachOrdered
in interface DoubleStream
public double[] toArray()
toArray
in interface DoubleStream
public double reduce(double identity, DoubleBinaryOperator op)
reduce
in interface DoubleStream
public OptionalDouble reduce(DoubleBinaryOperator op)
reduce
in interface DoubleStream
public <R> R collect(Supplier<R> supplier, ObjDoubleConsumer<R> accumulator, BiConsumer<R,R> combiner)
collect
in interface DoubleStream
public double sum()
sum
in interface DoubleStream
public OptionalDouble min()
min
in interface DoubleStream
public OptionalDouble max()
max
in interface DoubleStream
public long count()
count
in interface DoubleStream
public OptionalDouble average()
average
in interface DoubleStream
public DoubleSummaryStatistics summaryStatistics()
summaryStatistics
in interface DoubleStream
public boolean anyMatch(DoublePredicate predicate)
anyMatch
in interface DoubleStream
public boolean allMatch(DoublePredicate predicate)
allMatch
in interface DoubleStream
public boolean noneMatch(DoublePredicate predicate)
noneMatch
in interface DoubleStream
public OptionalDouble findFirst()
findFirst
in interface DoubleStream
public OptionalDouble findAny()
findAny
in interface DoubleStream
public Stream<Double> boxed()
boxed
in interface DoubleStream
public DoubleStream sequential()
sequential
in interface BaseStream<Double,DoubleStream>
sequential
in interface DoubleStream
public DoubleStream parallel()
parallel
in interface BaseStream<Double,DoubleStream>
parallel
in interface DoubleStream
public DoubleStream unordered()
unordered
in interface BaseStream<Double,DoubleStream>
public DoubleStream onClose(Runnable closeHandler)
onClose
in interface BaseStream<Double,DoubleStream>
public void close()
close
in interface AutoCloseable
close
in interface BaseStream<Double,DoubleStream>
public PrimitiveIterator.OfDouble iterator()
iterator
in interface BaseStream<Double,DoubleStream>
iterator
in interface DoubleStream
public Spliterator.OfDouble spliterator()
spliterator
in interface BaseStream<Double,DoubleStream>
spliterator
in interface DoubleStream
public boolean isParallel()
isParallel
in interface BaseStream<Double,DoubleStream>
public Stream<Double> getRawStream()
getRawStream
in interface DebuggableStreaming<Double>
public boolean isOutputtingResults()
isOutputtingResults
in interface DebuggableStreaming<Double>
Copyright © 2017. All rights reserved.