nodedeque-removelast.html
来自「经典的数据结构源代码(java 实现)」· HTML 代码 · 共 24 行
HTML
24 行
<html><head><title>Code Fragment</title></head><body text=#000000><center></center><br><br><dl><dd><pre> <font color=#8000a0><font color=#8000a0>public</font> </font>E <font color=#0000ff>removeLast</font>() <font color=#8000a0><font color=#ff8000>throws</font> </font>EmptyDequeException { <font color=#ff8000>if</font><font color=#0000ff> </font>(<font color=#0000ff>isEmpty</font>()) <font color=#8000a0><font color=#ff8000>throw</font> </font><font color=#ff8000>new</font> <font color=#0000ff>EmptyDequeException</font>(<font color=#008000>"Deque is empty."</font>); DLNode<E> last = trailer.<font color=#0000ff>getPrev</font>(); <font color=#8000a0>E </font>o = last.<font color=#0000ff>getElement</font>(); DLNode<E> secondtolast = last.<font color=#0000ff>getPrev</font>(); trailer.<font color=#0000ff>setPrev</font>(secondtolast); secondtolast.<font color=#0000ff>setNext</font>(trailer); size--; <font color=#8000a0><font color=#ff8000>return</font> </font>o; }</dl></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?