I am trying to extend the ArrayList class without much success. I want to expand it and be able to parameterize it.
So you have something like
ArrayList<SomeObject> list = new ArrayList<SomeObject>();
I want to
MyList<SomeObject> list = new MyList<SomeObject>();
A simple ArrayList extension does not work.
public class MyList extends ArrayList ...
When I try to use it, I get an error
MyList is not a generic type; This cannot be parameterized with <SomeObject> arguments
I tried the options
public class MyList extends ArrayList<Object> public class MyList<SubObject> extends ArrayList<Object>
without success. If I use a subobject behind the class name, it seems to work, but for some reason hides methods in the subobject.
Any thoughts or suggestions on how to get this job right are appreciated.
source share