T
typeMisMatch
Hi,
This may sound simple, here is my problem.
I have a couple classes, Class1, Class2, Class3.
Class1 has a collection of Class2 and Class3. Right now those collections
are defined as ArrayLists. This is a problem because when you reference them
eg: Class1.Class2s[index] you just get an Object because this is an
ArrayList as opposed to an Array of Class2.
So this means I have to do ((Class2)Class1.Class2s[index]).Method which
really sux. Now, if I make Class2s an Array such as Class2[], there is no
Add method to extend the array collection?
What is a good method of having a collection which is extendable but of a
particular type?
thanks
-c
This may sound simple, here is my problem.
I have a couple classes, Class1, Class2, Class3.
Class1 has a collection of Class2 and Class3. Right now those collections
are defined as ArrayLists. This is a problem because when you reference them
eg: Class1.Class2s[index] you just get an Object because this is an
ArrayList as opposed to an Array of Class2.
So this means I have to do ((Class2)Class1.Class2s[index]).Method which
really sux. Now, if I make Class2s an Array such as Class2[], there is no
Add method to extend the array collection?
What is a good method of having a collection which is extendable but of a
particular type?
thanks
-c