Hello,
Here is my updated code , have a look at it and if you find any errors in this then please guide me with the correct.
Code:
Public class GenTest <T> {
Public void call() {
/ / It does not generate the type new List (because it is not possible)
/ / This call compiles.
method(new List[] { new ArrayList <String>(), new LinkedList <Integer>() });
/ / It tries to put the same thing directly in varargs, it does
/ / Compile
/ / Because the compiler performs type checking safe
/ / It is therefore no way to get the wrong type
/ / Execution, hence the futility of warning
method(new ArrayList <String>(), new LinkedList <Integer>());
}
Public void method(Collection <T> ... p) {
}
}
Bookmarks