Java 8
About
1. Lambda Expressions
import java.util.*;
public class LambdaExample {
public static void main(String[] args) {
List<String> names = Arrays.asList("John", "Mary", "Peter", "Alice");
// Using lambda expression to sort the list
names.sort((s1, s2) -> s1.compareToIgnoreCase(s2));
System.out.println(names);
}
}2. Functional Interfaces and @FunctionalInterface Annotation
@FunctionalInterface Annotation3. Default and Static Methods in Interfaces
4. Streams API
Example:
5. Method References
6. Optional Class
7. New Date and Time API (java.time package)
java.time package)8. Collectors in Streams
9. forEach() Method in Iterable
forEach() Method in Iterable10. computeIfAbsent() and computeIfPresent() in Map
computeIfAbsent() and computeIfPresent() in Map11. String Joiner (java.util.StringJoiner)
java.util.StringJoiner)12. Base64 Encoding and Decoding
13. Arrays.parallelSort()
Arrays.parallelSort()Last updated