Live data from Hacker News

All New Java Language Features Since Java 21

inside.java

11–20 of 130 posts

Re: All New Java Language Features Since Java 21

#11
post #8

Earlier quoted context omitted.

Programming language is a tool. Java developers value stability and ease of understanding for the code. I've seen the nice features you complain that don't get used, reality is that nobody wants to waste time knowing them unless they are intuitive to use. Especially when are forcing to use newer JDKs. There is no value in solving a challenge in a way that only you understand or make others lose time trying to underst…

> You mention "var", why would we ever want in Java to hold a variable that you can't read immediately what is the type? var items = new HashMap(); Instead of HashMap items = new HashMap(); That's the point of var. It reduces noise a lot in some situations.

While I do use `var` when appropriate, your example is in general not appropriate

You would like to use Map items = new HashMap() since in general you do not want implementation detail leaking into contracts

Re: All New Java Language Features Since Java 21

#12
post #4

I am a big functional programming geek. I am one of the few people on the planet who can honestly say I have been paid to write F#, Haskell, Clojure, and Erlang. I have spoken at FP conferences like six or seven times, and I have shit on Java for most of my career. And yet, my latest talk at Lambda Days basically boiled down to “Java 21 and later don’t actually suck anymore”, and I genuinely do mean that. Java 21 is…

Programming language is a tool. Java developers value stability and ease of understanding for the code. I've seen the nice features you complain that don't get used, reality is that nobody wants to waste time knowing them unless they are intuitive to use. Especially when are forcing to use newer JDKs. There is no value in solving a challenge in a way that only you understand or make others lose time trying to underst…

The new features make the code easier to read. For example var:

    List accounts = List.of(new Account(1), new Account(2));
    var accounts = List.of(new Account(1), new Account(2));
It just reduces visual noise and boilerplate that you already know.

Java 8 is also a slow and old runtime. It performs terribly in 2025. Here’s a quote from 2020 and the gap has only gotten wider [0]:

> JDK 8 is an antiquated runtime. The default Parallel collector enters huge Full GC pauses and the G1, although having less frequent Full GCs, is stuck in an old version that uses just one thread to perform it, resulting in even longer pauses. Even on a moderate heap of 12 GB, the pauses were exceeding 20 seconds for Parallel and a full minute for G1. The ConcurrentMarkSweep collector is strictly worse than G1 in all scenarios, and its failure mode are multi-minute Full GC pauses.

You’re doing a disservice to everyone by continuing to use and glorify it.

[0] https://hazelcast.com/blog/performance-of-modern-java-on-dat...

Re: All New Java Language Features Since Java 21

#13
post #11
post #8

Earlier quoted context omitted.

> You mention "var", why would we ever want in Java to hold a variable that you can't read immediately what is the type? var items = new HashMap(); Instead of HashMap items = new HashMap(); That's the point of var. It reduces noise a lot in some situations.

While I do use `var` when appropriate, your example is in general not appropriate You would like to use Map items = new HashMap () since in general you do not want implementation detail leaking into contracts

Using var there doesn’t leak any implementation details into any contracts. Var is for local variables inside of functions. There are no details or contracts there.

Re: All New Java Language Features Since Java 21

#14
post #4

I am a big functional programming geek. I am one of the few people on the planet who can honestly say I have been paid to write F#, Haskell, Clojure, and Erlang. I have spoken at FP conferences like six or seven times, and I have shit on Java for most of my career. And yet, my latest talk at Lambda Days basically boiled down to “Java 21 and later don’t actually suck anymore”, and I genuinely do mean that. Java 21 is…

I view this largely as a symptom of the widescale “success” of the bloated J2EE app servers in the early 2000s to mid 2010s. Your Java version and dependencies were locked in and upgrading was a massive effort. A large group of developers stagnated on Java 1.4.2 and 5 and seemingly never updated their use of the language, even when moving to Java 8 and beyond. The legacy stuff keeps ticking along.

Re: All New Java Language Features Since Java 21

#15
post #12

Earlier quoted context omitted.

Programming language is a tool. Java developers value stability and ease of understanding for the code. I've seen the nice features you complain that don't get used, reality is that nobody wants to waste time knowing them unless they are intuitive to use. Especially when are forcing to use newer JDKs. There is no value in solving a challenge in a way that only you understand or make others lose time trying to underst…

The new features make the code easier to read. For example var: List accounts = List.of(new Account(1), new Account(2)); var accounts = List.of(new Account(1), new Account(2)); It just reduces visual noise and boilerplate that you already know. Java 8 is also a slow and old runtime. It performs terribly in 2025. Here’s a quote from 2020 and the gap has only gotten wider [0]: > JDK 8 is an antiquated runtime. The defa…

Using Java 8 doesn't mean using the java 8 JDK. It just means not using the newer features. I don't see anything in the parents post about restricting which JDK they use.

Re: All New Java Language Features Since Java 21

#17
post #10
post #4

I am a big functional programming geek. I am one of the few people on the planet who can honestly say I have been paid to write F#, Haskell, Clojure, and Erlang. I have spoken at FP conferences like six or seven times, and I have shit on Java for most of my career. And yet, my latest talk at Lambda Days basically boiled down to “Java 21 and later don’t actually suck anymore”, and I genuinely do mean that. Java 21 is…

I don’t use Java often, but many developers at my workplace do; they universally hate the new FP features.

Everyone seems to love them at my workplace and in /r/java.

Re: All New Java Language Features Since Java 21

#19
post #4

I am a big functional programming geek. I am one of the few people on the planet who can honestly say I have been paid to write F#, Haskell, Clojure, and Erlang. I have spoken at FP conferences like six or seven times, and I have shit on Java for most of my career. And yet, my latest talk at Lambda Days basically boiled down to “Java 21 and later don’t actually suck anymore”, and I genuinely do mean that. Java 21 is…

Programming language is a tool. Java developers value stability and ease of understanding for the code. I've seen the nice features you complain that don't get used, reality is that nobody wants to waste time knowing them unless they are intuitive to use. Especially when are forcing to use newer JDKs. There is no value in solving a challenge in a way that only you understand or make others lose time trying to underst…

I do not want to be rude but I am going to be: this entire comment illustrates my point very well. Instead of trying to actually learn new stuff, you say that the language peaked thirteen years ago.

> Everything that came after isn't really memorable nor helpful, especially lambdas.

Lambdas came out in Java 8, along with the streams API, and the fact that you don’t think they’re useful more demonstrates to me that you don’t actually understand it, since nearly every language before and after Java has lambdas and nearly everyone agrees that they’re useful.

Reifying a bunch of temporary interfaces is not “more readable” than a lambda. A bunch of terrible nested for-loop logic is not “more readable” than the streams API.

> You mention "var", why would we ever want in Java to hold a variable that you can't read immediately what is the type?

Your IDE can show the type, but even disregarding that there are lots of cases where you have to write the type twice in Java and it just makes noise. It doesn’t make the code more readable.

> we don't want to follow the same route of other programming languages unable to handle gigantic and complex platform systems.

Burying your head in the sand and Ignoring improvements in the language doesn’t make you more able to handle complex problems. It actually does the opposite and that’s so plainly obvious that I don’t think you actually thought through the sentence before you wrote it.

Take something like virtual threads. Most Java programmers don’t use them and instead keep using an executor service incorrectly because they also never learned the difference between blocking and non blocking IO. For them, virtual threads would be strictly better because it properly parks blocking IO.

Ultimately, I guess I disrespectfully disagree that Java “peaked” in 2012.

Re: All New Java Language Features Since Java 21

#20
post #8

Earlier quoted context omitted.

Programming language is a tool. Java developers value stability and ease of understanding for the code. I've seen the nice features you complain that don't get used, reality is that nobody wants to waste time knowing them unless they are intuitive to use. Especially when are forcing to use newer JDKs. There is no value in solving a challenge in a way that only you understand or make others lose time trying to underst…

> You mention "var", why would we ever want in Java to hold a variable that you can't read immediately what is the type? var items = new HashMap(); Instead of HashMap items = new HashMap(); That's the point of var. It reduces noise a lot in some situations.

You should write

    Map items = new HashMap();
It allows you to limit `items` usage to `Map` supertype and allows you to swap implementation easily, if necessary. `var` is weird feature, because it allows people to use implementation-specific methods methods and tie code to a single implementation, essentially making it less agile.

There are valid use-cases for `var`, but IMO this feature should not have been added to the language, as it's too dangerous and most people won't use it responsibly.

Post reply on HN