Compile-time question

Barry Burd bburd at drew.edu
Sun Apr 7 12:27:32 PDT 2013


Duh !!! I was looking everywhere else for the error. I'm not used to seeing this message in response to an access modifier issue...
 
CheckAgeForDiscount.java:36: error: method forEach in interface Stream<T> cannot
 be applied to given types;
      .forEach(p -> {
      ^
  required: Consumer<? super Person>
  found: (p)->{ p.d[...](); }
  reason: argument mismatch; cannot type-check lambda expression with inferred p
arameter types
      inferred types: Person
  where T is a type-variable:
    T extends Object declared in interface Stream
 
Thanks.
>>> On 4/7/2013 at 3:09 PM, in message <5161C451.8030003 at oracle.com>, Brian Goetz <brian.goetz at oracle.com> wrote:

display() is private in Person?

 


More information about the lambda-dev mailing list