Java_Magazine_NovemberDecember_2018

(singke) #1

39


//java at present/


J


DK 11 appeared in late September of this year. It’s the third delivered release using Oracle’s
new six-month cadence. This article covers the short list of principal features that you are
likely to encounter in the new release. They are
■■The new HTTP Client library
■■Local variable syntax for lambda parameters
■■Nests
■■Removal of deprecated modules
Let’s start with HTTP and WebSocket, because they’re likely to get a lot of your attention.

New HTTP Client and WebSocket API
Hot topics such as asynchronous programming, functional-style programming, and reactive
streams have been discussed in depth in previous Java Magazine articles. Their benefits are
clear: you can write code that reads closer to the business problem statement. This ability gives
you flexibility for requirements changes while also enabling some modern concurrency tech-
niques. Why then is a simple HTTP request to a web service so cumbersome? And is it limited to
blocking I/O?
For example, querying a website would be done as follows using the traditional
HttpURLConnection API:

URL url = new URL("http://iteratorlearning.com");
HttpURLConnection httpURLConnection
= (HttpURLConnection) url.openConnection();

What’s New in JDK 11?
New features facilitate writing lambdas, ease HTTP and WebSocket
communications, and help the JDK better handle inner classes.

RAOUL-GABRIEL URMA


RICHARD WARBURTON

Free download pdf