Stream API is used to process collections of data in a functional style.
List<Integer> nums = Arrays.asList(1, 2, 3, 4, 5);
nums.stream()
.filter(n -> n % 2 == 0)
.forEach(System.out::println);
# Output: 2 4Stream API is used to process collections of data in a functional style.
List<Integer> nums = Arrays.asList(1, 2, 3, 4, 5);
nums.stream()
.filter(n -> n % 2 == 0)
.forEach(System.out::println);
# Output: 2 4