provide a supplier who can provide a parameterized result

I’d like to use

Java.util.Optional.orElseThrow()

with an exception type that requires a constructor parameter. Something like this:

orElseThrow(MyException::new(someArgument)) // obviously NOT working

Is there a way to create a supplier that exceeds the value of my argument?

Leave a comment