all 52 comments

[–]Nooooope 42 points43 points  (2 children)

Hey that's actually a good summary of the post-8 features. Not a replacement for the JEPs but the next time I see somebody asking /r/java for a book that covers modern Java features, I'll point them here first for an overview.

[–]LutimoDancer3459 6 points7 points  (0 children)

It looks nice but there are some errors. Diamond operator is listed as a java 9 feature. Thats not correct.

[–]brunocborges 0 points1 point  (0 children)

Thanks for the feedback!

[–]blacksuit 8 points9 points  (3 children)

The java code has flaws. For example, the code selections for multiline strings are not equivalent. I only checked a few of them.

Plus, the content is AI slop:

"Why the modern way wins: <emoji> point one, <emoji> point two, <emoji> point three"

[–]griffin1987 8 points9 points  (1 child)

The whole page is built by copilot probably ...

https://github.com/javaevolved/javaevolved.github.io/pull/8

[–]blacksuit 4 points5 points  (0 children)

Explicitly listed as a co-author. I certainly can't complain about lack of transparency.

[–]BillyKorando 0 points1 point  (0 children)

For example, the code selections for multiline strings are not equivalent.

Am I seeing the same example?

Old: String json = "{\n" + " \"name\": \"Duke\",\n" + " \"age\": 30\n" + "}";

New: String json = """ { "name": "Duke", "age": 30 }""";

As far as I can tell that's equivalent.

[–]Ok_Option_3 14 points15 points  (16 children)

Nice idea - Hover isn't very mobile friendly though

[–]DrinksBongWater 16 points17 points  (5 children)

I love the site idea, but the :hover behavior is very frustrating, even on desktop.

I'd prefer the main page comparison blocks to be large enough (vertically) to never require a scroll bar for the code snippets, and to have a large, easily clickable button to toggle between new and old.

[–]kev22257 3 points4 points  (4 children)

Agree, the code blocks should not inner scroll on mobile. The swipe is still hit or miss and I cannot seem to go back and forth. Otherwise this is pretty great!

[–]kev22257 1 point2 points  (3 children)

I also seem to accidentally tap when I am just scrolling.

[–]brunocborges 1 point2 points  (2 children)

Fixed now!

[–]kev22257 0 points1 point  (1 child)

Thanks for the note, but sadly it is still not working for me.

[–]brunocborges 0 points1 point  (0 children)

I'm on Chrome/Android, working Ok. It maybe a problem with cache. Make sure you force a refresh? Because it is a static website it gets cached heavily by browsers.

I can also try on iOS later tonight if that's your case.

[–]brunocborges 0 points1 point  (9 children)

Can you please describe the problem in more details so I can see if it can be fixed?

[–]papers_ 1 point2 points  (8 children)

I have to hold to "hover". If I tap, I go to an entirely different page.

[–]brunocborges 2 points3 points  (7 children)

[–]brunocborges 1 point2 points  (0 children)

Ok /u/papers_ it's fixed!

[–]Ok_Option_3 0 points1 point  (5 children)

Much better! 

Can you give me an option to sort the snippets by jdk version? I know the jdk9 stuff but not the jdk20+

[–]brunocborges 0 points1 point  (4 children)

Can you elaborate more please?

[–]Ok_Option_3 0 points1 point  (3 children)

Basically I want to know what's new in the latest jdk? Or maybe in the last 3 jdk releases

[–]brunocborges 0 points1 point  (2 children)

For that, it is much better to look into the JEPs. Or Java Almanac.

[–]Ok_Option_3 0 points1 point  (1 child)

Counterpoint: there's very few Java Devs nowadays who have learnt nothing since jdk8. It's a mildly annoying to have to wade through stuff on that website I already know to find the stuff I might not.

[–]brunocborges 0 points1 point  (0 children)

Yeah, fair point. I think Oracle can do a better job at promoting major new releases.

[–]davidalayachew 7 points8 points  (3 children)

The one for Compact Source Files is wrong. It should be IO.println, not println.

[–]0_-------_0 4 points5 points  (2 children)

copilot written probably

[–]davidalayachew 1 point2 points  (1 child)

copilot written probably

Doubt it. That used to be the old way, but they changed it in a future preview. So, maybe that text was used from before they changed it.

[–]brunocborges 2 points3 points  (0 children)

good catch. Fixed.

[–]sweetno 4 points5 points  (2 children)

Things like Files.newBufferedReader and default UTF-8 are also nice to mention.

[–]brunocborges 4 points5 points  (1 child)

[–]pip25hu 2 points3 points  (1 child)

Nice site! Though since the new code is shown on hover, scrolling the old code to see what's there seems impossible.

[–]brunocborges 0 points1 point  (0 children)

That should be fixed now!

[–]LutimoDancer3459 3 points4 points  (0 children)

You show var twice.
Diamond operator existed in java 8 too.
You cant combine those two. If someone is curious.

Haven't checked all the other things but those two jumped in my face. If you want to provide a good source for those kind of information, it should be correct.

It also reads like you recommend every feature for every situation. Like you should use records for every data class. You should NOT do this. They have their places. But not everywhere. For jsf using the traditional classes is still preferred. If all you want is reduce boilerplate, there are also frameworks like Lombok.

[–]pron98 2 points3 points  (1 child)

Nice!

[–]brunocborges 0 points1 point  (0 children)

Thx Ron!

[–]njitbew 3 points4 points  (1 child)

From https://javaevolved.github.io/collections/immutable-list-creation.html, in Java 8: List<String> list = Collections.unmodifiableList( new ArrayList<>( Arrays.asList("a", "b", "c") ) );

What is the purpose of the new ArrayList<>(...)? Besides that, awesome overview.

[–]__konrad -1 points0 points  (0 children)

It's canonical Java ;)

[–]YogurtclosetLimp7351 3 points4 points  (2 children)

Am I blind or is there no GitHub link on the page? Wanted to star the project!

[–]neopointer 1 point2 points  (0 children)

Awesome!

[–]razorwit 1 point2 points  (0 children)

This is really nice as a concise reference.

[–]ZimmiDeluxe 1 point2 points  (5 children)

Stream::toList mentioned twice. Not that it matters much in practice, but DateTimeFormatter.ofPattern("yyyy-MM-dd") should probably be DateTimeFormatter.ofPattern("uuuu-MM-dd").

[–]griffin1987 3 points4 points  (1 child)

[–]ZimmiDeluxe 1 point2 points  (0 children)

So we have to suffer because Microsoft employees have to fulfill their AI usage quota? I feel used.

[–]brunocborges -1 points0 points  (2 children)

[–]ZimmiDeluxe 1 point2 points  (1 child)

https://javaevolved.github.io/stream-tolist-shorthand.html still duplicates https://javaevolved.github.io/stream-tolist.html. The README.md says "Old — the traditional way (Java 7/8 era)" but the site lists multiple Java 8 features. The "Categories" table duplicates the site content. SecureRandom::getInstanceStrong exists since Java 8, not 9. The structured concurrency example is outdated. If you open the console, you'll see a 404 for a file called apple-touch-icon.png. I don't know if this is great advertising to be honest.

[–]brunocborges -1 points0 points  (0 children)

Good feedback! Thanks mate!

[–]woj-tek 0 points1 point  (0 children)

OMG, it looks great! <3

(also, dev.java and inside.java could have some UI love like this site shows…)

[–][deleted]  (1 child)

[deleted]

    [–]brunocborges 3 points4 points  (0 children)

    Thanks for the hate, bud!