public class DebugLongStream extends Object implements LongStream, DebuggableStreaming<Long>
LongStream
wrapper, which allows overriding of only
two methods to allow seeing stream operation in realtime.LongStream.Builder
Modifier | Constructor and Description |
---|---|
protected |
DebugLongStream(LongStream stream,
boolean outputResults) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
builder, concat, empty, generate, iterate, of, of, range, rangeClosed
protected DebugLongStream(LongStream stream, boolean outputResults)
public static DebugLongStream of(LongStream stream)
DebugLongStream
using the default typestream
- The LongStream
to wrapDebugLongStream
wrapper of the provided LongStream
public static DebugLongStream of(LongStream stream, boolean outputResults)
DebugLongStream
using the default typestream
- The LongStream
to wrapoutputResults
- true
to output the results of the LongStream
as it is operated uponDebugLongStream
wrapper of the provided LongStream
public static DebugLongStream of(LongStream stream, Class<? extends DebugLongStream> type)
DebugLongStream
of the type parameter passed to the method. This is the appropriate
way to instantiate the DebugLongStream
, as future caching mechanisms will be in place to optimize this.
You may however expose the constructor if you so choose.stream
- The LongStream
to create a DebugLongStream
of.type
- The class representing the type of the DebugLongStream
to instantiateDebugLongStream
of the provided LongStream
public static DebugLongStream of(LongStream stream, boolean outputResults, Class<? extends DebugLongStream> type)
DebugLongStream
of the type parameter passed to the method. This is the appropriate
way to instantiate the DebugLongStream
, as future caching mechanisms will be in place to optimize this.
You may however expose the constructor if you so choose.stream
- The LongStream
to create a DebugLongStream
of.outputResults
- true
to output the results of the LongStream
as it is operated upontype
- The class representing the type of the DebugLongStream
to instantiateDebugLongStream
of the provided LongStream
, or the base class instance of
DebugLongStream
if the type either failed to instantiate or was null
.protected <R> R operate(Function<? super LongStream,? extends R> action)
Stream
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".
Stream
will need to be recreated each time.protected void operateVoid(Consumer<? super LongStream> action)
Stream
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 Stream
DebugStream.operate(Function)
public static <D> DebugLongStream mapFromObject(DebuggableStreaming<D> debugStream, ToLongFunction<? super D> mapper)
public static <D> DebugLongStream flatMapFromObject(DebuggableStreaming<D> debugStream, Function<? super D,? extends LongStream> mapper)
public LongStream filter(LongPredicate predicate)
filter
in interface LongStream
public LongStream map(LongUnaryOperator mapper)
map
in interface LongStream
public <U> Stream<U> mapToObj(LongFunction<? extends U> mapper)
mapToObj
in interface LongStream
public IntStream mapToInt(LongToIntFunction mapper)
mapToInt
in interface LongStream
public DoubleStream mapToDouble(LongToDoubleFunction mapper)
mapToDouble
in interface LongStream
public LongStream flatMap(LongFunction<? extends LongStream> mapper)
flatMap
in interface LongStream
public LongStream distinct()
distinct
in interface LongStream
public LongStream sorted()
sorted
in interface LongStream
public LongStream peek(LongConsumer action)
peek
in interface LongStream
public LongStream limit(long maxSize)
limit
in interface LongStream
public LongStream skip(long n)
skip
in interface LongStream
public void forEach(LongConsumer action)
forEach
in interface LongStream
public void forEachOrdered(LongConsumer action)
forEachOrdered
in interface LongStream
public long[] toArray()
toArray
in interface LongStream
public long reduce(long identity, LongBinaryOperator op)
reduce
in interface LongStream
public OptionalLong reduce(LongBinaryOperator op)
reduce
in interface LongStream
public <R> R collect(Supplier<R> supplier, ObjLongConsumer<R> accumulator, BiConsumer<R,R> combiner)
collect
in interface LongStream
public long sum()
sum
in interface LongStream
public OptionalLong min()
min
in interface LongStream
public OptionalLong max()
max
in interface LongStream
public long count()
count
in interface LongStream
public OptionalDouble average()
average
in interface LongStream
public LongSummaryStatistics summaryStatistics()
summaryStatistics
in interface LongStream
public boolean anyMatch(LongPredicate predicate)
anyMatch
in interface LongStream
public boolean allMatch(LongPredicate predicate)
allMatch
in interface LongStream
public boolean noneMatch(LongPredicate predicate)
noneMatch
in interface LongStream
public OptionalLong findFirst()
findFirst
in interface LongStream
public OptionalLong findAny()
findAny
in interface LongStream
public DoubleStream asDoubleStream()
asDoubleStream
in interface LongStream
public Stream<Long> boxed()
boxed
in interface LongStream
public LongStream sequential()
sequential
in interface BaseStream<Long,LongStream>
sequential
in interface LongStream
public LongStream parallel()
parallel
in interface BaseStream<Long,LongStream>
parallel
in interface LongStream
public LongStream unordered()
unordered
in interface BaseStream<Long,LongStream>
public LongStream onClose(Runnable closeHandler)
onClose
in interface BaseStream<Long,LongStream>
public void close()
close
in interface AutoCloseable
close
in interface BaseStream<Long,LongStream>
public PrimitiveIterator.OfLong iterator()
iterator
in interface BaseStream<Long,LongStream>
iterator
in interface LongStream
public Spliterator.OfLong spliterator()
spliterator
in interface BaseStream<Long,LongStream>
spliterator
in interface LongStream
public boolean isParallel()
isParallel
in interface BaseStream<Long,LongStream>
public Stream<Long> getRawStream()
getRawStream
in interface DebuggableStreaming<Long>
public boolean isOutputtingResults()
isOutputtingResults
in interface DebuggableStreaming<Long>
Copyright © 2017. All rights reserved.