InspectResultExtension<T extends Object?, E extends Object> extension

Extension methods for inspecting result values without transforming them.

Useful for logging, debugging, or side effects while preserving the result. These methods allow you to peek at the value or error without consuming the result, enabling fluent method chaining.

on

Methods

inspectErr(void block(E error)) Result<T, E>

Available on Result<T, E>, provided by the InspectResultExtension extension

Executes a side effect if this is an error, then returns this unchanged.
inspectOk(void block(T value)) Result<T, E>

Available on Result<T, E>, provided by the InspectResultExtension extension

Executes a side effect if this is a success, then returns this unchanged.