Expected behavior of a Streams.cycled() instance - found issues and questions

Paul Sandoz paul.sandoz at oracle.com
Wed Oct 24 02:01:36 PDT 2012

On Oct 23, 2012, at 9:17 PM, Paul Sandoz <Paul.Sandoz at oracle.com> wrote:

> On Oct 23, 2012, at 7:11 PM, Brian Goetz <brian.goetz at Oracle.COM> wrote:
>>>  5) cycledStream.uniqueElements() leads to IllegalStateException though
>>> it should not according to common sense.
> Got a stack trace?

This must have been:

        Streams.cycle(Arrays.asList(1, 2, 3)).uniqueElements().toArray();

as the framework knows that one is trying to push an infinite stream into a non-short circuiting terminal operation.

I think the conclusion is we should not bother throwing the ISE and just let things run out of memory.


More information about the lambda-dev mailing list