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

Paul Sandoz paul.sandoz at oracle.com
Wed Oct 24 04:41:02 PDT 2012


On Oct 24, 2012, at 1:31 PM, Dmitry Bessonov <dmitry.bessonov at oracle.com> wrote:

> On 24.10.2012 15:06, Dmitry Bessonov wrote:
>> 
>>> 
>>> 
>>>> Well, I'm not sure I agree with the notion of common sense here; I think
>>>> its a bit much to ask the runtime to do this kind of analysis.  But this
>>>> is a fine example of the sort of trouble we get in when we do try and
>>>> protect the user from themselves; this ISE is exactly what you're asking
>>>> for in (1), and we should probably remove it.
>>>> 
>>> Yeah, we can only catch some not all cases so it is inconsistent.
>> 
>> Well, but it is still possible to implement a special (smart) version of uniqueElements() for the cycled stream instances?
> 
> I mean - not for any cycled stream but for a cycled stream instance that we are confident about that it's cycled - created with Streams.cycled() method.
> 

Yes, it is be possible, but i consider it a very small edge case and i don't think it is worth the additional complexity required to support it.

Paul.


More information about the lambda-dev mailing list