> On 4 Nov 2015, at 10:03, Remi Forax <fo...@univ-mlv.fr> wrote: > > Hi Paul, > > The use of BaseStream was just an example, here is another one that works > only if the function first parameter type is declared as '? super > Stream<StackWalker.StackFrame>'. > > static Function<Stream<?>, Integer> counter() { > return stream::count; > } > > ... > StackWalker walker = ... > int count = walker.walk(counter()); >
Good point. Damn, i don’t like wildcards :-) The following works fine: static <T> Function<Stream<T>, Long> counter() { return Stream::count; } But there could also cases where one is stuck using a wildcard: Function<Stream<?>, Long> f = Stream::count; Paul.