This Java 8 program cubes each element of a list and filters the results to keep only values greater than 50.
Code Example:
import java.util.*;
public class Main {
public static void main(String[] args) {
List<Integer> integerList = Arrays.asList(4, 5, 6, 7, 1, 2, 3);
integerList.stream()
.map(i -> i * i * i)
.filter(i -> i > 50)
.forEach(System.out::println);
}
}Output:
64 125 216 343