我试图将一个整数数组添加到链接列表.我理解原始类型需要一个包装器,这就是我试图将我的int元素添加为整数的原因.提前致谢.
int [] nums = {3, 6, 8, 1, 5};
LinkedList<Integer>list = new LinkedList<Integer>();
for (int i = 0; i < nums.length; i++){
list.add(i, new Integer(nums(i)));
Run Code Online (Sandbox Code Playgroud)
对不起 - 我的问题是,如何将这些数组元素添加到我的LinkedList?