Package io.zeebe.test.util.stream
Class StreamWrapper<T,S extends StreamWrapper<T,S>>
- java.lang.Object
-
- io.zeebe.test.util.stream.StreamWrapper<T,S>
-
- All Implemented Interfaces:
AutoCloseable,BaseStream<T,Stream<T>>,Stream<T>
- Direct Known Subclasses:
ExporterRecordStream
public abstract class StreamWrapper<T,S extends StreamWrapper<T,S>> extends Object implements Stream<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.stream.Stream
Stream.Builder<T extends Object>
-
-
Constructor Summary
Constructors Constructor Description StreamWrapper(Stream<T> wrappedStream)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanallMatch(Predicate<? super T> predicate)booleananyMatch(Predicate<? super T> predicate)List<T>asList()voidawait()voidclose()<R> Rcollect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner)<R,A>
Rcollect(Collector<? super T,A,R> collector)longcount()Sdistinct()booleanexists()Sfilter(Predicate<? super T> predicate)Optional<T>findAny()Optional<T>findFirst()<R> Stream<R>flatMap(Function<? super T,? extends Stream<? extends R>> mapper)DoubleStreamflatMapToDouble(Function<? super T,? extends DoubleStream> mapper)IntStreamflatMapToInt(Function<? super T,? extends IntStream> mapper)LongStreamflatMapToLong(Function<? super T,? extends LongStream> mapper)voidforEach(Consumer<? super T> action)voidforEachOrdered(Consumer<? super T> action)TgetFirst()TgetLast()booleanisParallel()Iterator<T>iterator()Slimit(long l)Slimit(Predicate<T> predicate)short-circuiting operation; limits the stream to the first element that fulfills the predicate<R> Stream<R>map(Function<? super T,? extends R> mapper)DoubleStreammapToDouble(ToDoubleFunction<? super T> mapper)IntStreammapToInt(ToIntFunction<? super T> mapper)LongStreammapToLong(ToLongFunction<? super T> mapper)Optional<T>max(Comparator<? super T> comparator)Optional<T>min(Comparator<? super T> comparator)booleannoneMatch(Predicate<? super T> predicate)SonClose(Runnable runnable)Sparallel()Speek(Consumer<? super T> consumer)Optional<T>reduce(BinaryOperator<T> accumulator)Treduce(T identity, BinaryOperator<T> accumulator)<U> Ureduce(U identity, BiFunction<U,? super T,U> accumulator, BinaryOperator<U> combiner)Ssequential()Sskip(long l)SskipUntil(Predicate<T> predicate)Skips elements until the predicate is matched.Ssorted()Ssorted(Comparator<? super T> comparator)Spliterator<T>spliterator()protected abstract Ssupply(Stream<T> wrappedStream)Object[]toArray()<A> A[]toArray(IntFunction<A[]> generator)Sunordered()
-
-
-
Method Detail
-
skipUntil
public S skipUntil(Predicate<T> predicate)
Skips elements until the predicate is matched. Retains the first element that matches the predicate.
-
limit
public S limit(Predicate<T> predicate)
short-circuiting operation; limits the stream to the first element that fulfills the predicate
-
exists
public boolean exists()
-
await
public void await()
-
getFirst
public T getFirst()
-
getLast
public T getLast()
-
mapToInt
public IntStream mapToInt(ToIntFunction<? super T> mapper)
-
mapToLong
public LongStream mapToLong(ToLongFunction<? super T> mapper)
-
mapToDouble
public DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper)
- Specified by:
mapToDoublein interfaceStream<T>
-
flatMapToInt
public IntStream flatMapToInt(Function<? super T,? extends IntStream> mapper)
- Specified by:
flatMapToIntin interfaceStream<T>
-
flatMapToLong
public LongStream flatMapToLong(Function<? super T,? extends LongStream> mapper)
- Specified by:
flatMapToLongin interfaceStream<T>
-
flatMapToDouble
public DoubleStream flatMapToDouble(Function<? super T,? extends DoubleStream> mapper)
- Specified by:
flatMapToDoublein interfaceStream<T>
-
sorted
public S sorted(Comparator<? super T> comparator)
-
forEachOrdered
public void forEachOrdered(Consumer<? super T> action)
- Specified by:
forEachOrderedin interfaceStream<T>
-
toArray
public <A> A[] toArray(IntFunction<A[]> generator)
-
reduce
public T reduce(T identity, BinaryOperator<T> accumulator)
-
reduce
public Optional<T> reduce(BinaryOperator<T> accumulator)
-
reduce
public <U> U reduce(U identity, BiFunction<U,? super T,U> accumulator, BinaryOperator<U> combiner)
-
collect
public <R> R collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner)
-
min
public Optional<T> min(Comparator<? super T> comparator)
-
max
public Optional<T> max(Comparator<? super T> comparator)
-
iterator
public Iterator<T> iterator()
- Specified by:
iteratorin interfaceBaseStream<T,S extends StreamWrapper<T,S>>
-
spliterator
public Spliterator<T> spliterator()
- Specified by:
spliteratorin interfaceBaseStream<T,S extends StreamWrapper<T,S>>
-
isParallel
public boolean isParallel()
- Specified by:
isParallelin interfaceBaseStream<T,S extends StreamWrapper<T,S>>
-
sequential
public S sequential()
- Specified by:
sequentialin interfaceBaseStream<T,S extends StreamWrapper<T,S>>
-
parallel
public S parallel()
- Specified by:
parallelin interfaceBaseStream<T,S extends StreamWrapper<T,S>>
-
unordered
public S unordered()
- Specified by:
unorderedin interfaceBaseStream<T,S extends StreamWrapper<T,S>>
-
onClose
public S onClose(Runnable runnable)
- Specified by:
onClosein interfaceBaseStream<T,S extends StreamWrapper<T,S>>
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBaseStream<T,S extends StreamWrapper<T,S>>
-
-