Код: Выделить всё
public static SingleList copy(SingleList list1){
SingleList list2 = new SingleList();
ListNode current=list1.head;
while (current != null){
list2.addLast(current.getData());
current=current.getNext();
}
return list2;
}
Подробнее здесь: https://stackoverflow.com/questions/153 ... -list-node
Мобильная версия