递归书写方法
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/208e63876f698420e0454c625f127536.png)
1. 链表创建
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/eda398cc02bbc6b54ed1d2a4648d0d26.png)
public class Node {
private final int value;
private Node next;
public Node(int value) {
this.value = value;
this.next = null;
}
private Node create(List<Integer> linkedList){
if (linkedList.size() == 0){
return null;
}
Node nodeFirst = new Node(linkedList.get(0));
nodeFirst.setNext(create(linkedList.subList(1,linkedList.size())));
return nodeFirst;
}
2. 链表反转
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/130739086cc74c2a198fa3df9c3ca347.png)
private Node reverseListedList(Node head){
if (head == null || head.getNext() == null){
return head;
}
Node newHead = reverseListedList(head.getNext());
head