Skip to content

A library of useful Stream Gatherers (custom intermediate operations) for Java

License

Notifications You must be signed in to change notification settings

tginsberg/gatherers4j

Repository files navigation

Gatherers4j

A library of useful Stream Gatherers (custom intermediate operations) for Java 22+.

Installing

TBD, once I start publishing snapshots to Maven Central.

Use Cases

(Example, TODO clean this up)

Removing consecutive duplicate elements:

Stream
    .of("A", "A", "A", "B", "B", "C", "C", "D", "A", "B", "C")
    .gather(Gatherers4j.dedupeConsecutive())
    .toList();

// ["A", "B", "C", "D", "A", "B", "C"]

Limit the stream to the last n elements:

Stream
    .of("A", "B", "C", "D", "E", "F", "G")
    .gather(Gatherers4j.last(3))
    .toList();

// ["E", "F", "G"]

Contributing

Guidance forthcoming.

Copyright © 2024 by Todd Ginsberg

About

A library of useful Stream Gatherers (custom intermediate operations) for Java

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages