Why Java has provided Unbounded wild card if we can solve the problem using Generic type . For example
class UnBoundedUsage {
//Method 1
public static void unboundedMethod(List<?> list) {
for(Object obj : list) {
System.out.println(obj);
}
}
//Method 2
public static <T> void methodWithType(List<T> list) {
for(T obj : list) {
System.out.println(obj);
}
}
}
Can anyone please help me understand if Method 2 can solve our requirement then why do we need to have Method 1 . Means , which problem can be solved using Unbounded wildcard and that cannot be solved using Generic method Type (e.g Method 2) ?