π€Lazy Results
How to defer expensive calculations with Results
How to Use this Add-On
Group ID
Artifact ID
Latest Version
Creating Lazy Results
Supplier<Result<Integer, String>> supplier = () -> success(123);
Result<Integer, String> lazy = LazyResults.ofSupplier(supplier);/* Represents the operation we may omit */
Result<Long, Exception> expensiveCalculation(AtomicLong timesExecuted) {
long counter = timesExecuted.incrementAndGet();
return success(counter);
}Skipping Expensive Calculations
Triggering Result Evaluation
Handling Success and Failure Eagerly
Handling Success and Failure Lazily
Conclusion
Last updated
Was this helpful?