What are the new features in Java 8

Java 8 introduced several new features that enhance the Java programming language, making it more efficient, expressive, and user-friendly. The key features include Lambdas, the Stream API, new Date and Time API, Optional class, and others that improve productivity and code clarity.
java 8 features, java programming, lambdas, stream API, date and time API, optional class

        // Example of using Java 8 Lambda Expression
        List names = Arrays.asList("Alice", "Bob", "Charlie");
        
        // Using Lambda to print names
        names.forEach(name -> System.out.println(name));
        
        // Example of Stream API
        List filteredNames = names.stream()
                                           .filter(name -> name.startsWith("A"))
                                           .collect(Collectors.toList());
        System.out.println(filteredNames);
    

java 8 features java programming lambdas stream API date and time API optional class