On Thu, 14 Mar 2019 at 14:21, Brian Goetz <brian.go...@oracle.com> wrote: > There's a reason it took as long as it did for Stuart to come up with > this proposal; all the options were known for years, they all have > problems, and the net benefit is still relatively narrow, which means we > don't have a lot of budget before the cost-benefit becomes negative. I > think the option proposed is the least-worst, and people still seem to > really want to be able to foreach over streams.
The cost-benefit is definitely tight, but I think it is positive. As I said here [1] there is still a case for control abstractions in Java even when you have lambdas A new concern from me is that this change would allow Iterable and Stream to be used in foreach, but not Iterator. This seems like an odd/sharp conceptual edge. Why not make `Iterator` implement `IterableOnce`? The default method would obviously just return `this`. It seems to me that if we are willing to countenance foreach over a one-shot Stream, it is inappropriate to deny foreach to a one-shot Iterator. thanks Stephen [1] https://mail.openjdk.java.net/pipermail/amber-dev/2019-March/004127.html