I would like to get gain access to the type of Object held in a Collection. Below is a simplified example of when and why I might want to do this. Is this even possible?
List<Address> addressList = new LinkedList<Address>();
Main.addElement(addressList);
Class Main{
public void addElement(Object inArgument){
List<Object> argument = (List<Object>)inArgument;
argument.add( /* WOULD LIKE TO CREATE A NEW OBJECT OF THE APPROPRIATE TYPE
HERE, IN THIS CASE, IT WOULD BE OF TYPE: "Address" */ );
}
}