r/programming • u/diffallthethings • May 14 '15
Java 8, generic exceptions, and lambdas that throw
https://github.com/diffplug/durian/blob/develop/test/com/diffplug/common/base/ErrorsExample.java?ts=4
15
Upvotes
7
u/diffallthethings May 14 '15
In the first day of using Java 8, I was really excited by how compact and expressive the lambdas were. But I pretty quickly found that I had to puts lots of try/catch blocks inside my lambdas, which made things even less expressive than before.
I think this example shows how to fix this, and also goes into detail on how generic exceptions do (and don't) work.
-14
u/kirbyfan64sos May 14 '15
Java still sucks, but my main gripe has always been it's verbose error handling/exception specifiers. This library+lambdas might make me like Java.
JK! I'll just not hate it as much...
-30
u/[deleted] May 14 '15
[removed] — view removed comment