Given a list of famous programmers:
List<String> famousProgrammers = Arrays.asList(
"Linus Torvalds",
"John Carmack",
"James Gosling",
"Joshua Bloch",
"Ken Thompson"
);
The following code counts something using streams:
long result = famousProgrammers.stream()
.filter(name -> name.startsWith("J"))
.count();
The result is ...