logoalt Hacker News

throwaway203706/04/20252 repliesview on HN

    > Java has evolved to contain much of “ML the good parts”
Can you give some examples?

Replies

yz45306/04/2025

Not OP. IMO the recent Java changes, including pattern matching (especially when using along with sealed interface), virtual threads (and structured concurrency on the way), string templates, are all very solid additions to the language.

Using these new features one can write very expressive modern code while still being interoperable with the Java 8 dependency someone at their company wrote 20 years ago.

show 1 reply
PaulHoule06/04/2025

Like a lot of other languages, Java has gotten a big dose of

https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_sy...

To defy it's reputation for verbosity, Java's lambda syntax is both terse and highly flexible. Sum and product types are possible with records and sealed classes. Pattern matching.

show 1 reply