java - Check if two ArrayLists accept the same class (same generic) -
if have 2 empty arraylists, how can check if accept same class of object.
the function like,
public boolean havesametype(arraylist array1, arraylist array2){ ... }'
in general case, want able compare generics of 2 objects in class.
edit:
in specific case have abstract class
public abstract class dog<e extends cat> { ... }
and trying compare 2 objects know of class dog (or subclass obviously). cannot
dog adog //gives warning because dog should parameterized
so correct way create variable?
Comments
Post a Comment