In Java, while arrays are covariant, collections are invariant. For example, given that a Foo
is a Bar
, while we have a Foo[]
is a Bar[]
, we do not have that a Collection<Foo>
is a Collection<Bar>
. This implies that we cannot pass in a Collection<Foo>
where a Collection<Bar>
is needed. Why?