I\'ve always been wondering about some weird aspect of Java generics and the use of wildcards. Let\'s say, I have the following API:
public interface X
I've just seen this peculiar implementation of Collections.swap():
public static void swap(List> list, int i, int j) {
final List l = list;
l.set(i, l.set(j, l.get(i)));
}
The JDK guys resort to a raw type, in order to handle this, locally. To me, this is a strong statement indicating that this probably should be supported by the compiler, but for some reason (e.g. lack of time to formally specify this) just wasn't done