Because Stream<T>::<A>toArray(IntFunction<A[]>)
and Collection<E>::<T>toArray(T[])
both take an unbounded type parameter, I can do this:
class Dog {}
class Cat {}
List<Dog> dogs = ...;
Cat[] cats1 = dogs.stream().toArray(Cat[]::new); // allowed
Cat[] cats2 = dogs.toArray(new Cat[0]); // also allowed
Why can't the method signature be changed to Stream<T>::<A super T>toArray(IntFunction<A[]>)
and Collection<E>::<T super E>toArray(T[])
respectively?