A wrapper interface for Stream with exception support.
Given some Stream<T>
named source
ExStream<T> exStream = ExStreamBuilder.of(source)
Now one can use with throwable functions.
All terminal operations will throw ExStreamException
with the cause being the original exception thrown in the exceptional method.
exStream.exFilter(Functions::someExceptionalPredicate)
.exMap(Functions::someExceptionalMapper)
.exReduce(Functions::nonExceptionalReducingFunction)
.exFindFirst()
Good old Collectors
work
List<T> list = exStream.exCollect(Collectors.toList())
It's possible to obtain a Stream instance with exStream.toStream()
.
This instance can throw ExStreamRuntimeException
on any terminal operation.
You can use a released version from maven repositories
<dependency>
<groupId>io.github.pak3nuh.util</groupId>
<artifactId>exstream</artifactId>
<version>LATEST</version>
</dependency>