public int removeAll(int i){
while (head.getData() == i){
int value = head.getData();
head = head.getNext();
return value;
}
Node curr = head;
while (curr.getNext() != null){
if (curr.getNext().getData() != i){
int value = curr.getNext().getData();
curr.setNext(curr.getNext().getNext());
return value;
}
else {
curr = curr.getNext();
}
}
}
它一直说没有为函数指定返回,因为它是嵌套的,而不是在外循环上。我怎么能把它拿出来清除这个?