- Lambdas and Method References
- Functional Interfaces
- Streams (intermediate and terminal ops)
- Collectors (grouping, partitioning, mapping, reducing)
- Optional
- Default/Static methods in interfaces
- Date/Time (java.time)
- var (Java 10), Records (16), Sealed Classes (17), Pattern Matching
- Text Blocks (15), Switch Expressions (14)
Function<Integer,Integer> f = x -> x * x;List<String> names = List.of("a","b","c");
names.forEach(System.out::println);Function, Predicate, Supplier, Consumer, UnaryOperator, BinaryOperator, Comparator, Runnable, Callable.
Map<Integer, Long> freq = List.of(1,2,2,3,3,3)
.stream()
.collect(Collectors.groupingBy(x -> x, Collectors.counting()));Optional<String> os = Optional.of("x");
String v = os.map(String::toUpperCase).orElse("NA");LocalDateTime now = LocalDateTime.now();
ZonedDateTime z = now.atZone(ZoneId.of("UTC"));
Duration d = Duration.between(now, now.plusHours(5));