Java 12 introduces switch expressions. Together with a new lambda-style arrow syntax, this makes switch more expressive and less error-prone.
Posts about concepts of the Java programming language. This does not include posts which merely employ Java to talk about something else.
Think Java 11 is just a maintenance release? Think again! Here are eleven small but shiny additions to classes like String, Path, Files, Collection, Optional, and others that make coding a little more elegant.
From Java 11 on, you can execute a single source file without compiling it first. Beyond experimentation, you can write scripts this way. Even the shebang is supported!
With Java 11’s new reactive HTTP/2 API, request and response bodies can be handled with reactive streams, which gives you full control over the bytes going over the wire: you can throttle, stream, and even cancel early.
Java 11 ships with a new, fluent HTTP/2 API. This tutorial explains the basic building blocks and how to send requests synchronously and asynchronously.
Migrating from Java 8 to Java 11? Then this post has got you covered. It discusses licensing, long-term support, update preparations, version requirements, common migration challenges, and more.
With ‘var’ it is possible to ad-hoc combine traits into an instance that matches your exact requirements. This allows for pretty cool experimentation, but unfortunately has some serious downsides.
Local-variable type inference with `var` makes it easier to work with anonymous classes, for example to create ad-hoc fields and methods. But does that mean you should use them more often? I think not.
With ‘var’ it is much easier to work with intersection types in Java 10 and later. You still need non-trivial tricks with generics to declare intersection types, but thanks to ‘var’ it is now easy to create local variables of such types.
On Java 10+, you can use application class-data sharing to reduce launch times, response time outliers, and memory footprint. By archiving class data with -Xshare:dump and loading it with -Xshare:on, the JVM’s class loading workload can be reduced considerably.