Collectors update (original) (raw)
Remi Forax forax at univ-mlv.fr
Tue Jan 29 15:13:12 PST 2013
- Previous message: Collectors update
- Next message: Collectors update
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 01/29/2013 11:34 PM, Brian Goetz wrote:
I've done some refactoring in Collectors to address some issues, including approachability issues that were raised by Kevin. See if you like them.
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) {
in order to call this method users have to send a lambda that creates an array of parametrized type something which will be unsafe (the only way to get type safety is to create a class that inherits from Collection and to provide a type argument something like class Foo extends ArrayList {}) so while the code of the library is typesafe, no user code will never be typesafe.
and BTW, the IntFunction will be always called with 2 as argument.
Rémi
- Previous message: Collectors update
- Next message: Collectors update
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the lambda-libs-spec-observers mailing list