It just says:
Returns a sequential Stream with this collection as its source.
This method should be overridden when the spliterator() method cannot return a spliterator that is IMMUTABLE, CONCURRENT, or late-binding. (See spliterator() for details.)
But I can't find any code showing how it creates and returns the new Stream.
double average = roster
.stream()
.filter(p -> p.getGender() == Person.Sex.MALE)
.mapToInt(Person::getAge)`enter code here`
.average()
.getAsDouble();
roster
is aList<Person>
instance ofArrayList<Person>
Person
is a simple class that represents a person