Skip to content

A Stream wrapper with throwable function support

License

Notifications You must be signed in to change notification settings

pak3nuh/ExStream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExStream

A wrapper interface for Stream with exception support.

Usage

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.

Maven coordinates

You can use a released version from maven repositories

<dependency>
    <groupId>io.github.pak3nuh.util</groupId>
    <artifactId>exstream</artifactId>
    <version>LATEST</version>
</dependency>

About

A Stream wrapper with throwable function support

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages