This is part of JDK 9 in the form of or, which takes a Supplier<Optional<T>>. Your example would then be:
return serviceA(args)
.or(() -> serviceB(args))
.or(() -> serviceC(args));
For details see the Javadoc or this post I wrote.
This is part of JDK 9 in the form of or, which takes a Supplier<Optional<T>>. Your example would then be:
return serviceA(args)
.or(() -> serviceB(args))
.or(() -> serviceC(args));
For details see the Javadoc or this post I wrote.