Я пытаюсь создать метод преобразования связанного списка в arraylist.convert linklist to arraylist
public ArrayList<Integer> toList(){
//Node node;
Node current = node;
while(current != null){
current = current.next;
array.add(current.val);
}
}
и он показывает ошибку ниже
no suitable method found for add(Object)
method ArrayList.add(int,Integer) is not applicable
(actual and formal argument lists differ in length)
method ArrayList.add(Integer) is not applicable
(actual argument Object cannot be converted to Integer by method invocation conversion)
Я в настоящее время использую JDK 1.7, который из того, что я нашел в этом форуме, JDK 1.7 должно быть хорошо с этим вопросом. В чем проблема?