positionlist-list.html

来自「经典的数据结构源代码(java 实现)」· HTML 代码 · 共 41 行

HTML
41
字号
<html><head><title>Code Fragment</title></head><body text=#000000><center></center><br><br><dl><dd><pre>  <font color = #ff0080>/** Returns the number of elements in this list. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>int</font> <font color=#0000ff>size</font>();  <font color = #ff0080>/** Returns whether the list is empty. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>boolean</font> <font color=#0000ff>isEmpty</font>();  <font color = #ff0080>/** Returns the first node in the list. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>Position&lt;E&gt; <font color=#0000ff>first</font>();  <font color = #ff0080>/** Returns the last node in the list. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>Position&lt;E&gt; <font color=#0000ff>last</font>();  <font color = #ff0080>/** Returns the node after a given node in the list. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>Position&lt;E&gt; <font color=#0000ff>next</font>(Position&lt;E&gt; p)     <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException, BoundaryViolationException;  <font color = #ff0080>/** Returns the node before a given node in the list. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>Position&lt;E&gt; <font color=#0000ff>prev</font>(Position&lt;E&gt; p)     <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException, BoundaryViolationException;  <font color = #ff0080>/** Inserts an element at the front of the list, returning new position. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>void</font> <font color=#0000ff>addFirst</font>(E e);  <font color = #ff0080>/** Inserts and element at the back of the list, returning new position. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>void</font> <font color=#0000ff>addLast</font>(E e);  <font color = #ff0080>/** Inserts an element after the given node in the list. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>void</font> <font color=#0000ff>addAfter</font>(Position&lt;E&gt; p, <font color=#8000a0>E </font>e)     <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException;  <font color = #ff0080>/** Inserts an element before the given node in the list. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>void</font> <font color=#0000ff>addBefore</font>(Position&lt;E&gt; p, <font color=#8000a0>E </font>e)     <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException;  <font color = #ff0080>/** Removes a node from the list, returning the element stored there. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>E <font color=#0000ff>remove</font>(Position&lt;E&gt; p) <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException;  <font color = #ff0080>/** Replaces the element stored at the given node, returning old element. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>E <font color=#0000ff>set</font>(Position&lt;E&gt; p, <font color=#8000a0>E </font>e) <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException;</dl></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?