I am trying to convert and array ints to a List however every time I try I get a compilation error.
List<Integer> integers = toList(draw.getToto6From49().getFirstRound());
// getFirstRound() returns int[] ;
and here is my to toList
method
public class ArraysUtil {
public static <T> List<T> toList(T[] ts) {
List<T> ts1 = new ArrayList<>();
Collections.addAll(ts1, ts);
return ts1;
}
}
java: method toList in class com.totoplay.util.ArraysUtil cannot be applied to given types;
required: T[]
found: int[]
reason: inferred type does not conform to declared bound(s)
inferred: int
bound(s): java.lang.Object