πBenchmarks
Measuring performance to find out how fast Results are
Last updated
Was this helpful?
Was this helpful?
public String usingExceptions(int number) throws SimpleException {
if (number < 0) {
throw new SimpleException(number);
}
return "ok";
}public Result<String, SimpleFailure> usingResults(int number) {
if (number < 0) {
return Results.failure(new SimpleFailure(number));
}
return Results.success("ok");
}public String usingExceptions(int number) throws ComplexException {
try {
return simple.usingExceptions(number).toUpperCase();
} catch (SimpleException e) {
throw new ComplexException(e);
}
}public Result<String, ComplexFailure> usingResults(int number) {
return simple.usingResults(number)
.map(String::toUpperCase, ComplexFailure::new);
}