Traversable vs Iterable
Paul Sandoz
paul.sandoz at oracle.com
Tue Oct 30 04:04:33 PDT 2012
Hi Boaz,
We recently merged Traversable into Iterable:
http://hg.openjdk.java.net/lambda/lambda/jdk/rev/b93e380a7834
Paul.
On Oct 30, 2012, at 11:47 AM, Boaz Nahum <boaznahum at gmail.com> wrote:
> I'm just trying to understand the design guidelines
>
> /**
> * Implementing this interface allows an object to indicate that it provides
> * the {@code forEach} method for internal iteration.
> */
> public interface Traversable<T> extends Iterable<T> {
>
>
> In which case we want to prevent this ability from *Iterable* ?
>
> If we can always write:
>
> Iterable<T> it = ...
>
> for(T t:it) {}
>
> Why can't we:
> it.forEach(...)
>
>
> Thanks
> Boaz
>
More information about the lambda-dev
mailing list