Collectors update

Brian Goetz brian.goetz at oracle.com
Tue Jan 29 17:34:50 PST 2013


Now, that's an interesting idea.

On the one hand, it is perfect: you get a function Boolean -> T, which 
you can query as many times as you like, and not worry at all about 
where/how the data is stored.

On the other hand, it might well be confusing to Java developers, who 
are used to getting data structures (arrays, collections, maps) back 
from such functions.  And this would be the sole counterexample.

On 1/29/2013 8:24 PM, Remi Forax wrote:
> On 01/30/2013 02:15 AM, Brian Goetz wrote:
>>>> The silly Partition class was also evil.  We're in the "lesser of
>>>> evils" business here.
>>
>> Would a Map<Boolean, T> be better?  More boxing, but we can use an
>> EnumMap-like implementation, and no ctor needed.
>>
>>
>>
>
> yes, wrapping an array as a Map<Boolean,T> will work,
> but I think I prefer a BooleanFunction  (boolean -> T), there is less
> method to implement.
>
> Rémi
>


More information about the lambda-libs-spec-observers mailing list