Crossposted: How to difine type each object is in a ArrayList