Stream.flatMap signature is not correct (original) (raw)
Remi Forax forax at univ-mlv.fr
Sat Dec 1 15:20:18 PST 2012
- Previous message: Stream.flatMap signature is not correct
- Next message: Bikeshed opportunity: filter/map/reduce naming
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12/01/2012 06:55 PM, Remi Forax wrote:
On 12/01/2012 06:34 PM, Kevin Bourrillion wrote:
On Fri, Nov 30, 2012 at 8:44 PM, Remi Forax <forax at univ-mlv.fr_ _<mailto:forax at univ-mlv.fr>> wrote:
Stream.flatMap is currently specified as: Stream flatMap(FlatMapper<? super T, ? extends R> mapper); but should be: Stream flatMap(FlatMapper<? super T, ? super R> mapper);
I don't understand. If the mapper produces Numbers how can you return a stream of Integers? sorry, never send a mail Friday evening. Rémi
BTW, the problem of inference is still present:
Arrays.asList(Object.class, String.class).stream().flatMap( (block, clazz) -> { Arrays.asStream(clazz.getFields()).forEach(block); }); // doesn'tcompile
Arrays.asList(Object.class, String.class).stream().flatMap( (Block block, Class clazz) -> { Arrays.asStream(clazz.getFields()).forEach(block); }); // Ok
Also note that it doesn't work with the signature (Block, Class<?>) because Block is a subtype of Block<? super Field>. Rémi
- Previous message: Stream.flatMap signature is not correct
- Next message: Bikeshed opportunity: filter/map/reduce naming
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the lambda-libs-spec-experts mailing list