Streams – count() operation
class Test { public static void main(String[] args) { List<Integer> numbers = new ArrayList<>(Arrays.asList(1, 7, 9, 22, 19, 18, 47, 3, 12, 29, 17, 44, 78, 99)); long totalCount = numbers.stream().count(); System.out.println(“Total count of numbers: ” + totalCount); } } Output: Total count of numbers: 14 class Student { private String firstName; private String lastName;…
Read More Streams – count() operation