3 ms·
>The worst for me is that it's impossible to catch exceptions in lambdas. I don't take issue with your comment overall, but this is not true. You can catch exc
by oftenwrong 5y ago
>The worst for me is that it's impossible to catch exceptions in lambdas.
I don't take issue with your comment overall, but this is not true. You can catch exceptions within lambdas, and you can define functional interfaces that declare that they throw checked exceptions.
- ArnoVW 5y agoYou're right. It's been a while and I forgot the exact issue. I looked it up on StackOverflow, to refresh my memory [1]. It is indeed possible to thow exceptions within a lambda. My issue is that for something as everyday as "throwing exceptions", you have to define a separate interface, or catch it inside the lambda. The first option being the Evil Verbosity everyone is on about, the second essentially rendering the exception useless as an instrument. [1] : https://stackoverflow.com/questions/18198176/java-8-lambda-function-that-throws-exception https://stackoverflow.com/questions/18198176/java-8-lambda-f...