public static Node deleteAll(Node front, String target){
if (front == null){ return null;}
if (front.data.equals(target)){
return deleteAll(front.next,target);
}
front.next=deleteAll(front.next,target);
return front;
}
Run Code Online (Sandbox Code Playgroud)
我正试图通过这个解决方案,但这让我感到困惑.为什么它不总是以null结果,因为在结尾前面将等于null.