I see no difference in the following:
Object o = new LinkedList<Long>(); System.out.println(o instanceof List); System.out.println(o instanceof List<?>);
Is there any practical use instanceof List<?>when instanceof Listit cannot be used instead of vise versa?
instanceof List<?>
instanceof List
No difference. The wildcard is erased at compile time.
According to this blog, the answer is "they are exactly the same":
javac , ; , , (. ). , , w.r.t. .
Object o = new ArrayList<String>(); List<?> list_string = (List)o; //same as (List<?>)o boolean b = o instanceof List; //same as o instanceof List<?>