Skip to content

Commit

Permalink
Simplify call chain
Browse files Browse the repository at this point in the history
  • Loading branch information
mjanuszkiewicz-tt committed Mar 7, 2023
1 parent 0d9a33f commit 45928fc
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public int getTravelTime() {

private static <T> T findByNameOrError(String what, String name, Function<String, Optional<T>> finder) {
val result = finder.apply(name);
if (!result.isPresent()) {
if (result.isEmpty()) {
throw new IllegalArgumentException(String.format("Couldn't find a %s with the name %s", what, name));
} else {
return result.get();
Expand Down

0 comments on commit 45928fc

Please sign in to comment.