"All instances of a generic class have the same runtime class, regardless of their actual type parameters. So it is not meaningful to use the instanceof operator to check if an object is the instance of a particular invocation of a generic type."
Could you please explain by using code ?
"If someone asks you to do something you don't know how to, don't tell I don't know, tell I can learn instead." - Myself
An example: ArrayList<String> list1, ArrayList<List> list2, ArrayList<Integer> list3, ArrayList<Double> list4 are all reduced to the raw type ArrayList at runtime. So you can only ask if list1 instanceof ArrayList, or list2 instanceof ArrayList, and so on. You cannot ask if list1 instanceof ArrayList<String> or list2 instanceof ArrayList<List>