Skip to content

Latest commit

 

History

History
40 lines (25 loc) · 732 Bytes

README.md

File metadata and controls

40 lines (25 loc) · 732 Bytes

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