1. New methods to the String class: isBlank, lines, strip, stripLeading, stripTrailing, and repeat.
  2. readString and writeString static methods from the Files class
    Path filePath = Files.writeString(Files.createTempFile(tempDir, "demo", ".txt"), "Sample text");
    String fileContent = Files.readString(filePath);
    assertThat(fileContent).isEqualTo("Sample text");
    
  3. java.util.Collection interface contains a new default toArray method
    List sampleList = Arrays.asList("Java", "Kotlin");
    String[] sampleArray = sampleList.toArray(String[]::new);
    assertThat(sampleArray).containsExactly("Java", "Kotlin");
    
  4. A static not method has been added to the Predicate interface. Predicate.not(String::isBlank)
  5. The new HTTP client from the java.net.http package was introduced in Java 9. It has now become a standard feature in Java 11.The new HTTP API improves overall performance and provides support for both HTTP/1.1 and HTTP/2:
    HttpClient httpClient = HttpClient.newBuilder()
        .version(HttpClient.Version.HTTP_2)
        .connectTimeout(Duration.ofSeconds(20))
        .build();
    HttpRequest httpRequest = HttpRequest.newBuilder()
        .GET()
        .uri(URI.create("http://localhost:" + port))
        .build();
    HttpResponse httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
    assertThat(httpResponse.body()).isEqualTo("Hello from the server!");
    
  6. A major change in this version is that we don’t need to compile the Java source files with javac explicitly anymore:
    Before Java 11Version

    $ javac HelloWorld.java
    $ java HelloWorld 
    Hello Java 8!
    

    New Version

    $ java HelloWorld.java
    Hello Java 11!