If I have two empty arraylists, how can I check if they accept the same class of object.
The function would look something like,
public boolean haveSameType(ArrayList array1, ArrayList array2){ ... }'
In the general case, I want to be able to compare the generics of any two objects in a class.
Edit:
In my specific case I have an abstract class
public abstract class Dog<E extends Cat> { ... }
and I am trying to compare 2 objects which I know are of the class Dog (or a subclass obviously). However I cannot say
Dog aDog //gives a warning because Dog should be parameterized
So what is the correct way to create this variable?