News for hackers. Stuff that matters.
Re:Paving the on-ramp to Java by kubota on Thursday September 29, 2022 @08:39AM (#33019729)

    var ages = Map.of("sarah",19, "dan",35);   //valid java
Re:Paving the on-ramp to Java by ferd on Thursday September 29, 2022 @09:07AM (#33020059)
Nice, glad to see that added to the standard API (even if a bit too late).

Stressing the point: this welcomed improvement on the API is a lot more than "saving keystrokes".

Re:Paving the on-ramp to Java by jmartrican on Thursday September 29, 2022 @08:55AM (#33019912)
Map.of came out in JDK 9. I think there are still a lot of companies using JDK 8.... uhg. Maybe OP is one of the poor souls stuck in JDK 8.
Re:Paving the on-ramp to Java by cesarb on Thursday September 29, 2022 @09:13AM (#33020146)
For those of us still using Java 8, ImmutableMap.of() (from Guava) is similar (and probably the inspiration for Map.of()), as long as you don't need your Map to be modified later.
Re:Paving the on-ramp to Java by erik_seaberg on Thursday September 29, 2022 @09:43AM (#33020507)
We’re still using Java 8 in prod, because Java 9 broke our Hive version and a lot of other use cases for reflection (in return for modularizing stdlib, which we never cared about). I think some projects gave up on Java 9 as it neared EOL, and Java 11 compatibility still isn’t finished.
Re:Paving the on-ramp to Java by jmartrican on Thursday September 29, 2022 @08:56AM (#33019924)
Nice touch using "var" to show that off too.
Re:Paving the on-ramp to Java by RockingGoodNite on Thursday September 29, 2022 @09:18AM (#33020207)
var and static must die.