This program finds the total number of elements in a list of integers using Stream functions.
Code Example:
import java.util.*;
import java.util.stream.*;
public class FindTheTotalNumberOfElements {
public static void main(String args[]) {
List<Integer> myList = Arrays.asList(10, 15, 8, 49, 25, 98, 98, 32, 15);
long count = myList.stream().count();
System.out.println(count);
}
}Output:
9