Expected behavior of a Streams.cycled() instance - found issues and questions
Peter Levart
peter.levart at gmail.com
Tue Oct 23 23:51:18 PDT 2012
On 10/23/2012 07:11 PM, Brian Goetz wrote:
>> > 2) Getting next element of a flatMap of a cycled stream leads to hanging:
>> > Streams.cycle(Arrays.asList(1, 2, 3)).flatMap((Block<Object> sink,
>> >Integer element) -> {}).iterator().next();
> That seems like a bug...
>
infiniteStream.flatMap((sink, e) -> {})
seems to be semantically equivalent to:
infiniteStream.filter(e -> false)
so it should, and it does, behave the same.
Like you said:
> Users can create infinite loops now; we trust them
> to know whether they terminate.
Regards, Peter
More information about the lambda-dev
mailing list