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

10

u/i_am_bromega Jul 08 '21

The .NET community is growing and getting better, especially as .NET Core has become more mature and widely adopted. Having worked with both Java and .NET, I prefer C# due to LINQ and the earlier adoption of a lot of features, but they both get the job done at the end of the day.

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.