File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ public void addLast(E e) {
186186 }
187187```
188188### <font face =" 楷体 " id =" 3.3 " >根据位置取数据的方法</font >
189- ** get(int index):** : 根据指定索引返回数据
189+ ** get(int index):** 根据指定索引返回数据
190190``` java
191191public E get(int index) {
192192 // 检查index范围是否在size之内
@@ -220,7 +220,7 @@ public E peekFirst() {
220220getFirst(),element(),peek(),peekFirst()
221221这四个获取头结点方法的区别在于对链表为空时的处理,是抛出异常还是返回null,其中** getFirst()** 和** element()** 方法将会在链表为空时,抛出异常
222222
223- element()方法的内部就是使用getFirst()实现的。它们会在链表为空时,抛出NoSuchElementException
223+ element()方法的内部就是使用getFirst()实现的。它们会在链表为空时,抛出NoSuchElementException
224224** 获取尾节点(index=-1)数据方法:**
225225``` java
226226 public E getLast() {
@@ -359,7 +359,7 @@ E unlink(Node<E> x) {
359359
360360 // 删除前驱指针
361361 if (prev == null ) {
362- first = next;如果删除的节点是头节点,令头节点指向该节点的后继节点
362+ first = next;// 如果删除的节点是头节点,令头节点指向该节点的后继节点
363363 } else {
364364 prev. next = next;// 将前驱节点的后继节点指向后继节点
365365 x. prev = null ;
You can’t perform that action at this time.
0 commit comments