Discover and read the best of Twitter Threads about #Java16

Most recents (4)

Summary of #Java 8,9,10,11,12,13,14,15,16,17,18 features.
All features in a single post. #JDK #JRE #JavaAPI #Software

References: Oracle official website, Java doc and API specification doc.
docs.oracle.com/en/java/
#Java18 Features:
- UTF-8 by Default
- Simple Web Server
- Code Snippets in Java API Doc
- Reimplement Core Reflection with Method Handles
- Vector API
- Internet-Address Resolution SPI
- Foreign Function & Memory API
- Pattern Matching for switch
#Java17 Features (Long Term Support):
Restore Always-Strict Floating-Point Semantics
Enhanced Pseudo-Random Number Generators
New macOS Rendering Pipeline
macOS/AArch64 Port
Deprecate the Applet API for Removal
Strongly Encapsulate JDK Internals
Pattern Matching for switch
Read 12 tweets
Here are 11 improvements you get when updating to #Java16 later today: from records and type patterns to `Stream`-additions and Unix domain sockets, from creating installers to more performance and observability. 🧵👇🏾

(Longer form with tons of links: nipafx.dev/java-16-guide/)
#1 Records

Express in a single line that a type is just a collection of data without need for encapsulation and let the compiler do the rest:

record Range(int low, int high) { }

That results in almost the same API as the attached class. *drops mic* Image
#2 Type Pattern Matching

This is actually two-for-one:

* first step into pattern matching
* type patterns with `instanceof`

With a type pattern you check whether a variable is of a certain type and, if so, create a new variable of that type, so you can use it without casting. Image
Read 14 tweets
"Towards better serialization!"

That's a guiding light of #ProjectAmber and record serialization is the first step. The Inside Java Podcast episode on that topic with Julia Boes and @chegar999 (inside.java/2021/03/08/pod…) gives great insight into how it achieves that. 🧵

1/10
First, what's wrong with regular serialization? In short:

* extralinguistic mechanism (aka "magic")
* undermines encapsulation
* causes security issues
* hinders evolving code
* holds back new Java features

In long (and why it turned out that way), see attached thread.

2/10
"The magic is where the sin was" (@BrianGoetz) and so record serialization promises "what you see is what you get", making it:

1. easy to understand
2. no magic
3. more secure
4. more performant

3/10
Read 10 tweets
Project Amber is making progress on pattern matching in #JavaNext. Here are three recent developments that I'm very excited about and I think you will be as well.

(Caveats: these are ongoing discussions; none of this is final; speculation and strawman syntax ahead)
1. "Array patterns" allow matching and destructuring arrays. The `if`-line does three things:

a) is `objects` a `String` array with length 2?
b) if so, cast it to `String[]` and extract the two elements
c) declare `a` and `b` and assign the two elements to them
"Can I also bind the arrays as a whole?"

Likely. This is called an "as pattern".

"What if the array can have more elements?"

Allowing to express "at least two elements" is being considered - for example with three dots.
Read 11 tweets

Related hashtags

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!