So, I have a bit of a problem. I’m trying to convert an array of integers (called list) to an ArrayList (called arrList). The code shown below works fine:
java.util.ArrayList arrList = new java.util.ArrayList(Arrays.asList(list));
However, when compiled there is one warning: the line above is reported as using “unchecked or unsafe operations.”
Unfortunately, I cannot seem to dispose of this warning. Since this is a homework assignment, part of the criteria is to be warning-free. Is there any way I could convert the array to an ArrayList without warnings/errors?
Since your
listseems to be an array ofintand notInteger, you need to loop over them. Try the following: