Java 8

Java 8 introduced reduction operations which return one value by combing the contents of a stream. Below, we will use a lambda expression to filter elements that equal to true then call the Stream.count to count the number of booleans that exist in the stream.