Consider the following API method taken from Shiro\'s org.apache.shiro.subject.PrincipalCollection interface but probably present in other libraries as well:
The reason is quite simple:
You may read Object
s from a Collection>
the same way as from Collection
. But you can't add Object
s to a Collection>
(The compiler forbids this) whereas to a Collection
you can.
If after the release of Java 5 the compiler had translated every Collection
to Collection>
, then previously written code would not compile anymore and thus would destroy the backward compatibility.