Possible JSR-310 (date/time API) stream methods

Stephen Colebourne scolebourne at joda.org
Fri Mar 8 02:14:36 PST 2013


On 7 March 2013 20:44, Brian Goetz <brian.goetz at oracle.com> wrote:
> I think a useful mental model for "can I easily make a stream out of this"
> is "can I easily make an Iterator for this."  (Of course, there are other
> ways to construct a stream other than an Iterator.)
>
> So if you are tempted to write methods that would return an array or a
> Collection, consider whether instead (or in addition) to return a Stream.

Which comes back to an earlier question. Why should I return a Stream?
If I return an Iterator then that is more widely applicable and can be
converted to a stream is necessary...

Stephen


More information about the lambda-dev mailing list