⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 javautil.doc9.html

📁 java语言规范
💻 HTML
📖 第 1 页 / 共 2 页
字号:
first item (the item at index <code>0</code>) is returned.
<p><a name="22395"></a>
<p><font size=+1><strong>21.11.12   </strong> <code>public final Object <code><b>lastElement</b></code>()<br>throws NoSuchElementException</code></font>
<p>
<a name="22558"></a>
If this <code>Vector</code> is empty, a <code>NoSuchElementException</code> is thrown. Otherwise, the 
last item (the item at index <code>size()-1</code>) is returned.
<p><a name="22408"></a>
<p><font size=+1><strong>21.11.13   </strong> <code>public final void <code><b>addElement</b></code>(Object obj)</code></font>
<p>
<a name="22564"></a>
The size of this <code>Vector</code> is increased by <code>1</code> and <code>obj</code> becomes the new last item.
<p><a name="22397"></a>
<p><font size=+1><strong>21.11.14   </strong> <code>public final void <code><b>insertElementAt</b></code>(Object obj, int index)<br>throws <code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="22566"></a>
The size of this <code>Vector</code> is increased by <code>1</code> and <code>obj</code> becomes the new item at the 
specified <code>index</code>. Any item in this <code>Vector</code> that was previously at index <code>k</code> is first 
moved to index <code>k+1</code> if and only if <code>k</code> is not less than <code>index</code>.
<p><a name="22400"></a>
<p><font size=+1><strong>21.11.15   </strong> <code>public final boolean <code><b>removeElement</b></code>(Object obj)</code></font>
<p>
<a name="22803"></a>
If this <code>Vector</code> contains an occurrence of <code>obj</code>, then the first (lowest-indexed) such 
occurrence is removed, as if by the method <code>removeElementAt</code> <a href="javautil.doc9.html#22414">(&#167;21.11.16)</a>, and 
<code>true</code> is returned. If this <code>Vector</code> contains no occurrence of <code>obj</code>, this <code>Vector</code> is not 
modified and <code>false</code> is returned.
<p><a name="22414"></a>
<p><font size=+1><strong>21.11.16   </strong> <code>public final void <code><b>removeElementAt</b></code>(int index)<br>throws <code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="22599"></a>
The size of this <code>Vector</code> is decreased by <code>1</code> and the item at the specified <code>index</code> is 
removed from this <code>Vector</code>. Any item in this <code>Vector</code> that was previously at index 
<code>k</code> is first moved to index <code>k-1</code> if and only if <code>k</code> is greater than <code>index</code>.
<p><a name="22401"></a>
<p><font size=+1><strong>21.11.17   </strong> <code>public final void <code><b>removeAllElements</b></code>()</code></font>
<p>
<a name="22609"></a>
All elements are removed from this <code>Vector</code>, making it empty.
<p><a name="22442"></a>
<p><font size=+1><strong>21.11.18   </strong> <code>public final boolean <code><b>isEmpty</b></code>()</code></font>
<p>
<a name="22610"></a>
The result is <code>true</code> if and only if this <code>Vector</code> is empty, that is, its size is zero.
<p><a name="22430"></a>
<p><font size=+1><strong>21.11.19   </strong> <code>public final int <code><b>size</b></code>()</code></font>
<p>
<a name="22611"></a>
The size of this <code>Vector</code> (the number of items it currently contains) is returned.
<p><a name="22421"></a>
<p><font size=+1><strong>21.11.20   </strong> <code>public final void <code><b>setSize</b></code>(int newSize)</code></font>
<p>
<a name="22614"></a>
The size of this <code>Vector</code> is changed to <code>newSize</code>. If the new size is smaller than the 
old size, then items are removed from the end and discarded. If the new size is 
larger than the old size, then the new items are set to <code>null</code>.
<p><a name="22612"></a>
<p><font size=+1><strong>21.11.21   </strong> <code>public final int <code><b>capacity</b></code>()</code></font>
<p>
<a name="22632"></a>
The current capacity of this <code>Vector</code> (the length of its internal data array, kept in 
the field <code>elementData</code>) is returned.
<p><a name="22436"></a>
<p><font size=+1><strong>21.11.22   </strong> <code>public final void <code><b>ensureCapacity</b></code>(int minCapacity)</code></font>
<p>
<a name="22655"></a>
If the current capacity of this <code>Vector</code> is less than <code>minCapacity</code>, then its capacity 
is increased by replacing its internal data array, kept in the field <code>elementData</code> 
<a href="javautil.doc9.html#7702">(&#167;21.11.1)</a>, with a larger one. The size of the new data array will be the old size 
plus <code>capacityIncrement</code> <a href="javautil.doc9.html#7704">(&#167;21.11.3)</a>, unless the value of <code>capacityIncrement</code> is 
nonpositive, in which case the new capacity will be twice the old capacity; but if 
this new size is still smaller than <code>minCapacity</code>, then the new capacity will be 
<code>minCapacity</code>.
<p><a name="22659"></a>
<p><font size=+1><strong>21.11.23   </strong> <code>public final void <code><b>trimToSize</b></code>()</code></font>
<p>
<a name="22663"></a>
If the capacity of this <code>Vector</code> is larger than its current <code>size</code> <a href="javautil.doc9.html#22430">(&#167;21.11.19)</a>, then the 
capacity is changed to equal the size by replacing its internal data array, kept in 
the field <code>elementData</code>, with a smaller one.
<p><a name="22660"></a>
<p><font size=+1><strong>21.11.24   </strong> <code>public final void <code><b>copyInto</b></code>(Object anArray[])<br>throws IndexOutOfBoundsException</code></font>
<p>
<a name="22684"></a>
All the items in this <code>Vector</code> are copied into the array <code>anArray</code>. The item at index 
<code>k</code> in this <code>Vector</code> is copied into component <code>k</code> of <code>anArray</code>. If the length of <code>anArray</code> 
is smaller than the size of this <code>Vector</code>, an <code>IndexOutOfBoundsException</code> is 
thrown.
<p><a name="7715"></a>
<p><font size=+1><strong>21.11.25   </strong> <code>public final Enumeration <code><b>elements</b></code>()</code></font>
<p>
<a name="22685"></a>
An <code>Enumeration</code> <a href="javautil.doc.html#23147">(&#167;21.1)</a> is returned that will generate all items in this <code>Vector</code>. 
The first item generated is the item at index <code>0</code>, then the item at index <code>1</code>, and so on.
<p><a name="7716"></a>
<p><font size=+1><strong>21.11.26   </strong> <code>public final boolean <code><b>contains</b></code>(Object elem)</code></font>
<p>
<a name="22695"></a>
The result is <code>true</code> if and only if some item in this <code>Vector</code> is the same as <code>elem</code>, as 
determined by the <code>equals</code> method <a href="javalang.doc1.html#14865">(&#167;20.1.3)</a>.
<p><a name="7717"></a>
<p><font size=+1><strong>21.11.27   </strong> <code>public final int <code><b>indexOf</b></code>(Object elem)</code></font>
<p>
<a name="22703"></a>
If an item equal to <code>elem</code> is in this <code>Vector</code>, then the index of the first such occurrence
is returned, that is, the smallest value <code>k</code> such that:
<p><pre><a name="22704"></a><code>elem.equals(elementData[k])
</code></pre><a name="22705"></a>
is <code>true</code>. If no such item occurs in this <code>Vector</code>, then <code>-1</code> is returned.<p>
<a name="7718"></a>
<p><font size=+1><strong>21.11.28   </strong> <code>public final int <code><b>indexOf</b></code>(Object elem, int index)<br>throws IndexOutOfBoundsException</code></font>
<p>
<a name="22724"></a>
If an item equal to <code>elem</code> is in this <code>Vector</code> at position <code>k</code> or higher, then the index of 
the first such occurrence is returned, that is, the smallest value <code>k</code> such that:
<p><pre><a name="22725"></a><code>elem.equals(elementData[k]) &amp;&amp; (k &gt;= index)
</code></pre><a name="22726"></a>
is <code>true</code>. If no such item occurs in this <code>Vector</code>, then <code>-1</code> is returned.<p>
<a name="7719"></a>
<p><font size=+1><strong>21.11.29   </strong> <code>public final int <code><b>lastIndexOf</b></code>(Object elem)</code></font>
<p>
<a name="22762"></a>
If an item equal to <code>elem</code> is in this <code>Vector</code>, then the index of the last such occurrence
is returned, that is, the largest value <code>k</code> such that:
<p><pre><a name="22763"></a><code>elem.equals(elementData[k])
</code></pre><a name="22764"></a>
is <code>true</code>. If no such item occurs in this <code>Vector</code>, then <code>-1</code> is returned.<p>
<a name="7720"></a>
<p><font size=+1><strong>21.11.30   </strong> <code>public final int <code><b>lastIndexOf</b></code>(Object elem, int index)<br>throws IndexOutOfBoundsException</code></font>
<p>
<a name="22775"></a>
If an item equal to <code>elem</code> is in this <code>Vector</code> at position <code>k</code> or lower, then the index of 
the last such occurrence is returned, that is, the largest value <code>k</code> such that:
<p><pre><a name="22776"></a><code>elem.equals(elementData[k]) &amp;&amp; (k &lt;= index)
</code></pre><a name="22777"></a>
is <code>true</code>. If no such item occurs in this <code>Vector</code>, then <code>-1</code> is returned.<p>


<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="javautil.doc8.html">Prev</a> | <a href="javautil.doc10.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<p>
<font size=-1>Java Language Specification (HTML generated by Suzette Pelouch on February 24, 1998)<br>
<i><a href="jcopyright.doc.html">Copyright &#169 1996 Sun Microsystems, Inc.</a>
All rights reserved</i>
<br>
Please send any comments or corrections to <a href="mailto:doug.kramer@sun.com">doug.kramer@sun.com</a>
</font>
</body></html>

⌨️ 快捷键说明

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