Collectors update (original) (raw)

Remi Forax forax at univ-mlv.fr
Tue Feb 5 11:11:31 PST 2013


On 02/05/2013 05:53 PM, Brian Goetz wrote:

4. Rejigger Partition to return an array again, with an explicit lambda (which will likely be an array ctor ref) to make the array. Eliminated the silly Partition class.

Please don't do that, it's pure evil. public static Collector<T, Collection[]> partitioningBy(Predicate predicate, IntFunction<Collection[]> arraySupplier) { I've refactored this to make the partition collectors return Map<Boolean, X>.

I think returning a boolean -> T (or Boolean -> T) is better because it's conceptually more lightweight than a Map. I expect to see more function instead of a Map returned as result of a method.

Otherwise, like any other Map returned by the JDK, it should be serializable.

Rémi



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