public Node recursiveGet(int index, Node head, int times){
if (index < 0 || index > size){
throw new IllegalArgumentException("index illegal.");
}
if (times != index)
return recursiveGet(index, head.next, times + 1);
else return head;
}
调用时 :
Node cur = recursiveGet(index, dummyHead, 0);