List of new features since Java 8

Java 9

Java 10

Java 11

  • New String Methods
    " ".isBlank, str.lines(), strip(). stripLeading(), stripTailing(), repeat(int)
  • Reading/Writing strings to files
    Files.writeString
    Files.readString
  • Local variable syntax for lamda parameters
    (var s1, var s2) -> s1 + s2
  • Reflection access control stuff
    Class.getNestHost, getNestMembers, isNestmateOf
  • HTTP client improvements supporting HTTP 1.1 and Websocket
  • Optional.isEmpty

Java 12

  • Switch expressions
    String result = switch (day) {
                case "M", "W", "F" -> "MWF";
                case "T", "TH", "S" -> "TTS";
                default -> {
                    if(day.isEmpty())
                        break "Please insert a valid day.";
                    else
                        break "Looks like a Sunday.";
                }

  • File.mismatch

  • Compact number formatting
    NumberFormat.getCompactNumberInstance
  • Collectors.teeing
  • String.indent, transform, describeConstable, resolveContantDesc
  • Pattern matching for instanceof
    if (obj instanceof String s)

Java 13

  • Text blocks
    String textBlock = """
    		   Hi
    		   Hello
    		   Yes""";

  • Text block methods
    formatted, stripIndent, translateEscapes
  • Switch statement
    return -> yield
  • New implementation of Socket API