indexlist-list.html

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

HTML
29
字号
<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>/** Inserts an element e to be at index i, shifting all elements after this. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>void</font> <font color=#0000ff>add</font>(<font color=#8000a0>int</font> i, <font color=#8000a0>E </font>e)     <font color=#8000a0><font color=#ff8000>throws</font> </font>IndexOutOfBoundsException;  <font color = #ff0080>/** Returns the element at index i, without removing it. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>E <font color=#0000ff>get</font>(<font color=#8000a0>int</font> i)     <font color=#8000a0><font color=#ff8000>throws</font> </font>IndexOutOfBoundsException;  <font color = #ff0080>/** Removes and returns the element at index i, shifting the elements after this. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>E <font color=#0000ff>remove</font>(<font color=#8000a0>int</font> i)    <font color=#8000a0><font color=#ff8000>throws</font> </font>IndexOutOfBoundsException;  <font color = #ff0080>/** Replaces the element at index i with e, returning the previous element at i. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>E <font color=#0000ff>set</font>(<font color=#8000a0>int</font> i, <font color=#8000a0>E </font>e)    <font color=#8000a0><font color=#ff8000>throws</font> </font>IndexOutOfBoundsException;</dl></body></html>

⌨️ 快捷键说明

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