I have an ArrayList<Container>
, However, Container
can be Container<String>
, Container<Integer>
etc. while iterating the arraylist, I need to find out what type of container it is and respond accordingly. I know that java has type erasure, but is there a way to pre-store the type and retrieve it later? something like
public T type;
and to use it later such as
container.type A = container.dosomething();