Hey, I just realized
what generics are ;)
I think the angle bracket syntax for generics are ugly. Why not have a MagicType class that does not have to be casted? All the data structures can have an optional Class[] parameter that says what classes are allowed.
Example:
GenericList list = new GenericList(new Class[] { String.class });
list.add("test");
String a = list.remove(0);
System.out.println(a);
GenericList's psuedocode would look like this:
class GenericList {
public GenericList(Class[] types) {
// save the types in an instance variable.
}
public void add(Object a) {
// check if a instanceof types[x], if not, throw RuntimeException
}
public MagicType remove(int index) {
// MagicType is an Object that automatically casts to something
return objectAtIndex(index);
}