Sitemap

Java 8/11/17 Features

2 min readJun 15, 2026

--

Most Important Java 8 Features

  • Lambda
List<String> names = List.of("A", "B", "C");

names.forEach(name -> System.out.println(name));
  • Streams
List<String> result = names.stream()
.filter(n -> n.startsWith("A"))
.toList();
  • Optional
Optional<User> user = repository.findById(1L);
  • CompletableFuture
@Async
public CompletableFuture<String> process() {
return CompletableFuture.completedFuture("Done");
}
  • Functional Interfaces
@FunctionalInterface
interface Calculator {
int add(int a, int b);
}

Common interfaces:

  • Predicate<T>
  • Function<T,R>
  • Consumer<T>
  • Supplier<T>

Most Important Java 11 Features

  • HttpClient

Get Ravi Jaisawal’s stories in your inbox

Join Medium for free to get updates from this writer.

HttpClient client = HttpClient.newHttpClient();

HttpRequest request =
HttpRequest.newBuilder()
.uri(URI.create("https://api.com"))
.build();

HttpResponse<String> response =
client.send(request,
HttpResponse.BodyHandlers.ofString());
  • String API Enhancements
  • Files API
String content =
Files.readString(path);

Files.writeString(path, content);

Most Important Java 17 Features

  • Records
public record User(
String name,
int age
) {}
Automatically generates:
Constructor
Getters
equals()
hashCode()
toString()
  • Sealed Classes

Only permitted subclasses can extend.

public sealed class Shape
permits Circle, Rectangle {
}
  • Pattern Matching
if(obj instanceof String s) {
System.out.println(s.length());
}
  • Switch Expressions
return switch(day) {
case MONDAY -> 1;
default -> 0;
};

Java 8, 9, 10, 11, and 17 features:

Press enter or click to view image in full size

Most Important of Java 8/11/17

Press enter or click to view image in full size

--

--

Ravi Jaisawal
Ravi Jaisawal

Written by Ravi Jaisawal

Lead Software Engineer with 12+ years of experience architecting and delivering scalable, cloud-native distributed systems and enterprise platforms.