The anyMatch() method doesn't care what the exact type is, as long as the predicate can *consume* a T.
For instance, let's say you have a Stream<BigDecimal> and a Stream<AtomicLong>, and you want to check if both of these streams contain a value that is larger than 50. You could write the following predicate for both:
You can pass largerThanFifty to both streams and it would work, because the first accepts a Predicate<? super BigDecimal> and the second accepts a Predicate<? super AtomicLong>, and Predicate<Number> fits both.
There is a mnemonic to remember this. PECS: Producer extends, consumer super. A Predicate is a consumer of T (that is, it only uses T as method parameters, not as return types), so it uses the super keyword to specify a lower bound. When you need a producer of T, (a type that only returns T, and doesn't use it for method parameters), then you use the extends keyword.