Return type | Name and parameters |
---|---|
long
|
size()
An alias for count .
|
An alias for count
. Returns the count of elements for this stream.
This is a terminal operator and, depending on the underlying stream, may invoke
the stream pipeline, leaving it empty after this call.
Care should be taken with stream pipelines that have side effects.
This method should not be called on an infinite stream.
long[] nums = [1, 2, 3] assert nums.longStream().size() == 3