Examples

Basic Pipeline

Pipe4j.from(5)
    .perform(x -> x + 10)
    .perform(y -> y * 2)
    .get(); // Result: 30

Handling Exceptions

Pipe4j.from(10)
    .perform(input -> input / 2)
    .perform(res -> {
        if (res == 5) {
            throw new Exception("Result cannot be 5");
        }
        return res;
    }, e -> 0) // Fallback value
    .get(); // Result: 0 (if exception occurs)

Mixed Types

Pipe4j.from("5")
    .perform(Integer::parseInt)
    .perform(num -> num * 2)
    .perform(Object::toString)
    .get(); // Result: "10"

Last updated