Gatherers4J

A library of useful custom intermediate stream operations for Java.

Why Are We Here?

Since Streams were fist introduced in Java 8, there has been a way for us to write our own terminal operations with Collectors. However, there has not been a convenient way to write our own intermediate operations. Also, there are a lot of intermediate operations that seem like they would be good additions ot the JDK, but adding all of them to the Stream API would make it more difficult to learn and maintain.

Enter Gatherers! Finally, we have the ability to plug our own intermediate operations into Java Streams, so we can make life easier for ourselves, or use that sequence operation from another language that we miss in Java.

This library aims to provide a comprehensive and useful set of Gatherers (intermediate operations).

Shortcuts

Features

A Single Tiny Dependency

Don’t you hate it when you find a library that meets your needs only to discover that it comes with a massive tree of mandatory dependencies that conflict with your project?

Gatherers4j has a single dependency. JSpecify annotations are used on all public methods and types so static type checkers can more easily check for nullability issues. It’s there to help you write better code. JSpecify is tiny (it is made up of only four annotations) and stable.

A Single Entrypoint

All the Gatherers in this library are exposed through a single class, Gatherers4jfor simplicity. The groups outlined above are only represented explicitly in the documentation.

Apache 2.0 License

This project is licensed under the business-friendly Apache 2.0 license, which means your legal team can probably stop sweating because Apache 2.0 is generally well-received in enterprise settings. You should definitely run this by your Actual Lawyers™ though!