DEV Community

Discussion on: What's new and interesting in Java?

Collapse
 
awwsmm profile image
Andrew (he/him)

Java SE 12 has been out since March.

JDK 13 is on its way. New features to be included in 13:

"""
easy
multiline
comments
like
in
Python
"""

Improved switch statements as a precursor to pattern matching.

Improved APIs for sockets and improved garbage collection and memory management.


JDK 12 had more exciting new features like:

tee-ing streams:

double average = Stream.of(1, 4, 2, 7, 4, 6, 5)
    .collect(teeing(
        summingDouble(i -> i), 
        counting(),
        (sum, n) -> sum / n));

Java Microbenchmark Harness (JMH) is now a part of JDK. Great for benchmarking code.


...essentially, two or three new syntax features, a few API updates, and some JVM updates each release.

Collapse
 
kenbellows profile image
Ken Bellows

Those switch expressions are super cool, and if pattern matching is coming too, that will be awesome.

Fun fact, there's a proposal for pattern matching for JavaScript/ECMAScript as well: github.com/tc39/proposal-pattern-m...