Convenient methods in old Iterable
Paul Sandoz
paul.sandoz at oracle.com
Fri Oct 19 04:00:44 PDT 2012
On Oct 19, 2012, at 3:53 AM, Marcos Antonio <marcos_antonio_ps at hotmail.com> wrote:
> Hello! The methods isEmpty() and count() in Iterable were very convenient to me.
An Iterable may not know it's size, or the elements of the Iterable cannot be efficiently counted. See the Sized interface.
> Now with Stream do I always need to convert the stream to a collection or an array (into() and toArray() methods) to get the same functionality or is there an easier way? Thank you.
>
You might be able to check if the Iterable is an instance of Sized.
Paul.
More information about the lambda-dev
mailing list