| title | Algorithm4 Java Solution 1.3.24 | ||
|---|---|---|---|
| date | 2019-07-04 05:47:10 +0800 | ||
| draft | false | ||
| tags |
|
||
| categories |
|
Write a method removeAfter() that takes a linked-list Node as argument and removes the node following the given one (and does nothing if the argument or the next field in the argument node is null).
public static<Item> void removesAfter(Node<Item> n){
if(n==null || n.next==null){
return;
}
n.next = n.next.next;
}when I saw xiaohei'scode. He writes a generic method which confuses me.
Here is a clearer explanation:
