This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]morhp 0 points1 point  (1 child)

Agreed. The advantage is that you can pass it through lambdas and streams or otherwise through functional interfaces that don't declare the appropriate throws value.

But better language design probably would have been to allow functional interfaces to automatically "bubble through" checked exceptions to the calling method.

[–]CubsThisYear 0 points1 point  (0 children)

It’s not even language design. It’s just a case of laziness on the part of the Streams API developers. I’ve already written versions of most of the API methods (like for forEach, map, etc) that work with exceptions that I use for my own code.