[infinispan-dev] Distributed Streams

Dan Berindei dan.berindei at gmail.com
Tue Jul 14 02:11:53 EDT 2015


On Mon, Jul 13, 2015 at 9:30 PM, Tristan Tarrant <ttarrant at redhat.com> wrote:
>
>
> On 10/07/2015 00:10, Galder Zamarreno wrote:
>>> After the discussion we started in Galder's PR's comments [1], I
>>> started thinking that we should really have a stream() method directly
>>> in the Cache/AdvancedCache interface.
>>
>> ^ I don't think that's a good idea. A stream of what? keys only? values and keys?
>>
>> In the end you'd end up with 2/3 stream methods....
>
> I agree with Galder here: streams only apply to Collections and not to
> Maps (like in the JDK). It has already proven difficult mimicking the
> Map interface in a distributed environment: let's not aggravate this.
>
> entrySet().stream(), keySet().stream() are unambiguous and respect the
> original interfaces.

I was thinking stream() would stream CacheEntries, like
cacheEntrySet().stream() does in Will's PR. But I guess people who
want to try the streaming API will still go for entrySet().stream()
first, and they'll only try to find another method if it doesn't work
or if they need access to the metadata.

Dan


More information about the infinispan-dev mailing list