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) {
186
186
}
187
187
```
188
188
### <font face =" 楷体 " id =" 3.3 " >根据位置取数据的方法</font >
189
- ** get(int index):** : 根据指定索引返回数据
189
+ ** get(int index):** 根据指定索引返回数据
190
190
``` java
191
191
public E get(int index) {
192
192
// 检查index范围是否在size之内
@@ -220,7 +220,7 @@ public E peekFirst() {
220
220
getFirst(),element(),peek(),peekFirst()
221
221
这四个获取头结点方法的区别在于对链表为空时的处理,是抛出异常还是返回null,其中** getFirst()** 和** element()** 方法将会在链表为空时,抛出异常
222
222
223
- element()方法的内部就是使用getFirst()实现的。它们会在链表为空时,抛出NoSuchElementException
223
+ element()方法的内部就是使用getFirst()实现的。它们会在链表为空时,抛出NoSuchElementException
224
224
** 获取尾节点(index=-1)数据方法:**
225
225
``` java
226
226
public E getLast() {
@@ -359,7 +359,7 @@ E unlink(Node<E> x) {
359
359
360
360
// 删除前驱指针
361
361
if (prev == null ) {
362
- first = next;如果删除的节点是头节点,令头节点指向该节点的后继节点
362
+ first = next;// 如果删除的节点是头节点,令头节点指向该节点的后继节点
363
363
} else {
364
364
prev. next = next;// 将前驱节点的后继节点指向后继节点
365
365
x. prev = null ;
You can’t perform that action at this time.
0 commit comments