[concurrency-interest] Subject: Re: ConcurrentHashMapV8

Jed Wesley-Smith jed at atlassian.com
Wed Feb 26 22:43:08 EST 2014


This is a persistent, immutable structure, and so has no atomicity issues.

next() returns a new Stream<T>, which may be empty. An empty Stream may
return an empty Stream in the tail. Alternately you could have a never
empty Stream (head always returns something) and tail returns
Option<Stream<T>>.

Obviously this was before Java8's Stream, so the name now clashes.


On 25 February 2014 03:08, Martin Buchholz <martinrb at google.com> wrote:

>
>
>
> On Sun, Oct 9, 2011 at 2:32 PM, Jed Wesley-Smith <
> jwesleysmith at atlassian.com> wrote:
>
>> The functional/persistent Stream interface is a great alternative that
>> doesn't rely on null being magic:
>>
>> Stream<T> {
>>   T get(); // throws if empty aka head()
>>   Stream<T> next(); // aka tail()
>>   boolean isEmpty();
>> }
>>
>> implementations can be strict or lazy, but each actual instance is
>> referentially transparent.
>>
>
> I don't quite understand this - it seems to reintroduce the atomicity
> problem of Iterator hasNext/next.  Iterators solve this (annoyingly for the
> implementer) by creating a one-element buffer to hold the promised next
> element, and this would have to do likewise?  Or else isEmpty is just a
> hint?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140227/bf0fe909/attachment.html>


More information about the Concurrency-interest mailing list