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 a List instance of ArrayList
Person is a simple class that represents a person
解决方案
Basically the whole stream implementation is package private so you won't get anything showing up at docs.oracle.com.
You can start with StreamSupport which most classes uses to create the various streams.