fastcodejava
fastcodejava

Reputation: 41077

Why autoboxing does not work with Predicate

I have this code:

System.out.println(test( (int i) -> i == 5) ); // Error here

System.out.println(test( (Integer i) -> i == 5) ); // No error here

private static boolean test(Predicate<Integer> p) {
  return p.test(5);
}

Upvotes: 2

Views: 87

Answers (0)

Related Questions