Getting Started
Gatherers4j releases are published to Maven Central, the latest version is 0.12.0.
Maven
Add the following dependency to pom.xml:
<dependency>
<groupId>com.ginsberg</groupId>
<artifactId>gatherers4j</artifactId>
<version>0.12.0</version>
</dependency>
Gradle
Add the following dependency to build.gradle or build.gradle.kts:
implementation('com.ginsberg:gatherers4j:0.12.0')
Example Usage
The Gatherers4j class is the main entrypoint for this library.
Here’s a simple example that imports Gatherers4j, sets up a Stream<String>,
keeps the last three elements, and puts them in a List<String>:
import com.ginsberg.gatherers4j.Gatherers4j;
import java.util.stream.Stream;
Stream.of("A", "B", "C", "D", "E")
.gather(Gatherers4j.takeLast(3))
.toList();
// Returns: [ "C", "D", "E" ]