What is the return type of `Stream.count()`?

Java Professional Easy

Java Professional — Easy

What is the return type of `Stream.count()`?

Key points

  • The `count()` method in Java returns the number of elements in the stream.
  • The return type is `long` to accommodate large numbers of elements.
  • It is important to remember the specific return type of each stream operation.

Ready to go further?

Related questions