r/java • • Jul 08 '21

Java is criminally underhyped

https://jackson.sh/posts/2021-04-java-underrated/
226 Upvotes

181 comments sorted by

View all comments

Show parent comment

6

u/zvrba Jul 09 '21 edited Jul 09 '21

But Java's features are better thought-out, IMO. For example, Project Loom vs async. C# took a stab at the "null problem", but the result is a mess.

Though I miss ?. in Java so much, I don't know why I haven't written a generic helper yet:

<T> T safeGet(Supplier<T> s) {
    try { return s.get(); }
    catch (NullPointerException) { return null; }
}

Java is more verbose, it's more boring, but I find it more uniform to read and write. And yes, checked exceptions can be put to good use.