void (String[] args) { Optional<Either<IllegalArgumentException, String>> eith = Optional.of(new Either<IllegalArgumentException, String>()); eith.map(either -> { String foo = Test.foo(either); return foo; }).orElse("Hello"); eith.map(either -> { return Test.foo(either); }).orElse("Hello"); eith.map(either -> Test.foo(either)).orElse("Hello"); }