Skip to content

G-Lem/java9-presentation

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Java 9

1. Overview

  • Date de release 2017/03/23

2. New features planned

2.1. Jigsaw

2.2. HTTP/2

La version actuellement supportée est toujours la 1.1, datant de 1999.
La nouvelle API supportant la version 2 sera bien plus simple à utiliser (utilisatio du pattern Builder)

2.3. Process API

Mise à jour de l’API Process afin de simplifier la récupération et la gestion des processus systèmes :

// Get PIDs of own or started processes
out.println("Your pid is " + ProcessHandle.current().getPid());

Process p = Runtime.getRuntime().exec("sleep 1h");
ProcessHandle h = ProcessHandle.of(p.getPid())  // Optional
        .orElseThrow(IllegalStateException::new);

// Do things on exiting process          // CompletableFuture
h.onExit().thenRun( ()-> out.println("Sleeper exited") );

// Get info on process
out.printf("[%d] %s - %s\n", h.getPid(),
           h.info().user().orElse("unknown"),
           h.info().commandLine().orElse("none"));

// Kill a process
h.destroy();

2.4. REPL (JShell)

REPL = Read Eval Print Loop

Correspond au projet Kulla, maintenant connu comme JShell.

2.5. Immutable collection factories

Merci Guava !

/* Comment sections would break ... */
List<Integer> listOfNumbers = List.of(1, 2, 3, 4, 5/*, null*/);

Set<Integer> setOfNumbers = Set.of(1, 2, 3, 4, 5/*, 1*/);

Map<String, String> mapOfString =
    Map.of("key1", "value1", "key2", "value2");

Map<String, String> moreMapOfString =
    Map.ofEntries(
        Map.entry("key1", "value1"),
        Map.entry("key2", "value2")/*,
        Map.entry("key1", "value3")*/
);

2.6. HTML5 Javadoc

2.7. Garbage Collector G1

Devient le garbage collector par défaut

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors