Java 8 Features

Lambda Expressions

(a, b) -> a + b

Lambda Expression are used to implement the method defined in a functional interface.  Syntax : (parameters) -> expression

Functional Interfaces

Interfaces with a single abstract method, known as functional interfaces, are ideal for lambda expressions.

@FunctionalInterface interface MyFunction {    void execute(); }

Method References

Method references provide a shorthand for calling methods using the :: operator.

list.forEach(System.out::println);

Stream API

A Stream is not a data structure; it is a sequence of elements that can be processed in parallel or sequentially. We can get streams from collections, arrays, or strings

list.stream().filter(s -> s.startsWith("A")).collect(Collectors.toList());

forEach() Method

The forEach() method allows for concise iteration over collections.

list.forEach(item -> System.out.println(item));

Read More in Detail