I'm really having trouble understanding at an intuitive level why the following causes a compile time error.
Collection<String> c1 = new ArrayList<>();
Collection<Object> c2 = c1;
I understand that the second statement above is illegal but I can't wrap my head around it. String is an Object but a Collection of strings is not a collection of objects ? What makes this illegal ? Everywhere I read the tutorials simply state that the inheritance relationship does not hold when dealing with generic collections but don't offer much explanation as to why.