java 9 - кратко о новом
TRANSCRIPT
Java 9
, 2017
- Jigsaw
Jshell
Ahead-of-Time
Process API
Images API -
HTTP 2
Java 9: 2017
Java 9
Java 7
10
,
Jigsaw
Java , :
: 137
JavaFX: 30
XML: 10
java.base: 19
Jigsaw:
, com.sun.* .
.
- .
,
, , , .
tab
/
;
JShell Java 9
: main, .
- "Hello World!".
- Spring, Hibernate, , JS - , , - , .
JShell
JRE, JDK
Ahead-of-Time
jaotc ( JIT ) .
AoT , Java , - , . - , , , .
java.base, , , . , 64- Linux. .
, , . iOS , Java Apple.
.
java.util.concurrent.Flow:
Flow.Processor Flow.Publisher Flow.Subscriber Flow.Subscription
, . . .Reactive Streams API
Publish Subscribe Framework
java.lang.ProcessHandle:
pid
. , : ProcessHandle.onExit().Process API
java.awt.image.MultiResolutionImage . , , , .
: . java.awt.Graphics . Images API
Java 8: :
Map immutableMap =
Collections.unmodifiableMap( new HashMap() {{ put("key1",
"Value1"); put("key2", "Value2"); put("key3", "Value3"); }});
Java 9:
List immutableList = List.of("one", "two");Set iSet = Set.of("value1", "value2");Map iMap = Map.of("key1", "Value1", "key2", "Value2");
Java 8. . .
.
, .Private
try-- Java 7.
, , . :
void printFileJava7() throws IOException { try (FileInputStream myInput = new FileInputStream("myfile.txt")) { int data = myInput.read(); while(data != -1){ System.out.print((char) data); data = myInput.read(); } }}
Try--
Java 9 try, , , .
void printFileJava9() throws IOException { final FileInputStream myInput = new FileInputStream("myfile.txt") try (myInput) { int data = myInput.read(); while(data != -1){ System.out.print((char) data); data = myInput.read(); } }}
Try--
Diamond operator .
List preJava7 = new ArrayList();List java7 = new ArrayList();
, . :
List list = new ArrayList(){ ... };
@Deprecated Java API .
@Deprecated forRemoval since. Deprecated
HTTP API HTTP/2 -. API HTTPURLConnection. , , . : HTTP- :
URI testPageURI = new URI("http://127.0.0.1:8080/testPage");CompletableFuture nonBlockingResponse = HttpRequest .create(testPageURI) .GET().responseAsync();int tries = 0;while (!nonBlockingResponse.isDone() && tries++ < 5) { Thread.sleep(5); } if (nonBlockingResponse.isDone()) { HttpResponse response = nonBlockingResponse.get(); System.out.println("status code : " + response.statusCode() + " --> " + response.body(HttpResponse.asString()));} else { nonBlockingResponse.cancel(true); System.out.println("Cancelling, could not get response");}
HTTP 2
Desktop Java . - . JavaFX ! : , , , - .
java.awt.Desktop . , , , .
, , , .. , , , , , .
, . , OS X Windows.
Applet API
Java
javac Java 1.4 .
. .
Optional, Stream or
SafeVarrargs
TIFF, , Java 2D
UTF-8
JAR
ECMAScript 6.
, Docker
Unicode 8.0
,
JVM
Stack-Walking API stack traces.
Java
JavaDoc HTML 5
JSON API
(var)
, Java 10 Java 9
http://programtalk.com/java/java-9-new-features/http://openjdk.java.net/projects/jigsaw/quick-starthttp://download.java.net/java/jdk9/docs/api/overview-summary.htmlhttps://habrahabr.ru/company/piter/blog/271941/https://habrahabr.ru/company/piter/blog/272861/https://tproger.ru/news/jaotc-wtf/,