Proposed API for JEP 259: Stack-Walking API
    Paul Sandoz 
    paul.sandoz at oracle.com
       
    Wed Nov  4 09:57:41 UTC 2015
    
    
  
> On 4 Nov 2015, at 10:03, Remi Forax <forax at 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.
    
    
More information about the core-libs-dev
mailing list