generics - Why using weak typing array for Vector, ArrayList and the whole Java collection framework -


i wondering why didn't vector api (as others) choose use strong typing underlying array code below ? why using week typing object ? isn't better strong typing type safety resolved in compile time ?

public class vector<e> {     private static final initialcapacity = 2;     protected e[] elementdata;      private vector(class<e> c) {         @suppresswarnings("unchecked")         final e[] elementdata = (e[]) array.newinstance(c, initialcapacity);     }    } 

vector, arraylist, , whole collections framework written before generics thing in first place. didn't have alternative @ point, , had left way backwards compatibility.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -