I have following function:
public static <T> List<T> list(T... xs) {
final List<T> lst = new ArrayList<T>();
for (final T x : xs) {
lst.add(x);
}
return lst;
}
Its usage is simple:
List<Integer> ints = list(1, 2, 3, 4)
Compiler gives me following warning for this list
"TypeSafety: potential heap pollution for via varargs parameter
I tried to find what it means but all explanastions I found were for functions of parameters that are themselves parametrized e.g.
f(List<T>... xss).
While I have function of generic non parametrized parameter.
Please explain me what is the potential problem with my function because I can not find any.