I created a new class of objects, say Titi. Then I created an ArrayList of Titi, say TitiList Ok it works. After that, I want to retrieve each element of my TitiList, like TitiList.get(i), AND I want this get method to return an object of type Titi, instead of the default Object type. How can I do that?
Thanks, Ptite Ce.
class TitiList /*extends ArrayList*/
{
/* constructor */
...
/* methods */
public Titi myGet(int index) {
returns ....???
}
}
I found the answer by myself (wooo!). People told me that usually it is better to cast the get() out from my new class (it seems to be the usual way of doing it) What do you think about this advice?