Worked example
List<Integer> nums = List.of(3, -1, 4, -2, 5);
long positives = nums.stream()
.filter(n -> n > 0)
.count();
System.out.println(positives); // 3
nums.stream().filter(n -> n > 0).forEach(n -> System.out.println(n));
// 3, then 4, then 5 — in list order
count() returns a long; cast to int if you need one.