I've been getting odd compile errors when trying to sort while using
generics.
I have the following code:
static final List<Class> levelList;
static {
Vector<Class> v = new Vector<Class>() ;
v.add(myClass1. class);
v.add(myClass2. class);
v.add(myClass3. class);
Collections.sor t(v);
levelList = Collections.unm odifiableList(v );
}
which causes the compile error:
C:\dev\cvs.kitf ox.com\scarlet\ src\com\kitfox\ scarlet\levels\ ScarletLevelLis t.java:34:
cannot find symbol
symbol : method sort(java.util. List<java.lang. Class>)
location: class java.util.Colle ctions
Collections.sor t((List<Class>) v);
However, if I change the sort command to
Collections.sor t((List)v);
Things work. Is there a way to write the above code so that it
compiles correctly with generics?
Mark McKay
--
http://www.kitfox.com