What benefit gives us the second signature method with wildcard <?>
?
public static <T> void firstCheckList(List<T> myList, T obj)
public static <T> void secondCheckList(List<?> myList, T obj)
What benefit gives us the second signature method with wildcard <?>
?
public static <T> void firstCheckList(List<T> myList, T obj)
public static <T> void secondCheckList(List<?> myList, T obj)
The benefit is that in the 2nd option the list members don't need to be the same type as obj
If there is a correlation between myList and obj (type-wise) it is best to use the 1st option, if there isn't use the 2nd option