stack.html
来自「j2se5-api-zh,java文档的中文版本」· HTML 代码 · 共 420 行 · 第 1/2 页
HTML
420 行
返回对象在栈中的位置,以 1 为基数。</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.util.Vector"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从类 java.util.<A HREF="Vector.html" title="java.util 中的类">Vector</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="Vector.html#add(E)">add</A>, <A HREF="Vector.html#add(int, E)">add</A>, <A HREF="Vector.html#addAll(java.util.Collection)">addAll</A>, <A HREF="Vector.html#addAll(int, java.util.Collection)">addAll</A>, <A HREF="Vector.html#addElement(E)">addElement</A>, <A HREF="Vector.html#capacity()">capacity</A>, <A HREF="Vector.html#clear()">clear</A>, <A HREF="Vector.html#clone()">clone</A>, <A HREF="Vector.html#contains(java.lang.Object)">contains</A>, <A HREF="Vector.html#containsAll(java.util.Collection)">containsAll</A>, <A HREF="Vector.html#copyInto(java.lang.Object[])">copyInto</A>, <A HREF="Vector.html#elementAt(int)">elementAt</A>, <A HREF="Vector.html#elements()">elements</A>, <A HREF="Vector.html#ensureCapacity(int)">ensureCapacity</A>, <A HREF="Vector.html#equals(java.lang.Object)">equals</A>, <A HREF="Vector.html#firstElement()">firstElement</A>, <A HREF="Vector.html#get(int)">get</A>, <A HREF="Vector.html#hashCode()">hashCode</A>, <A HREF="Vector.html#indexOf(java.lang.Object)">indexOf</A>, <A HREF="Vector.html#indexOf(java.lang.Object, int)">indexOf</A>, <A HREF="Vector.html#insertElementAt(E, int)">insertElementAt</A>, <A HREF="Vector.html#isEmpty()">isEmpty</A>, <A HREF="Vector.html#lastElement()">lastElement</A>, <A HREF="Vector.html#lastIndexOf(java.lang.Object)">lastIndexOf</A>, <A HREF="Vector.html#lastIndexOf(java.lang.Object, int)">lastIndexOf</A>, <A HREF="Vector.html#remove(int)">remove</A>, <A HREF="Vector.html#remove(java.lang.Object)">remove</A>, <A HREF="Vector.html#removeAll(java.util.Collection)">removeAll</A>, <A HREF="Vector.html#removeAllElements()">removeAllElements</A>, <A HREF="Vector.html#removeElement(java.lang.Object)">removeElement</A>, <A HREF="Vector.html#removeElementAt(int)">removeElementAt</A>, <A HREF="Vector.html#removeRange(int, int)">removeRange</A>, <A HREF="Vector.html#retainAll(java.util.Collection)">retainAll</A>, <A HREF="Vector.html#set(int, E)">set</A>, <A HREF="Vector.html#setElementAt(E, int)">setElementAt</A>, <A HREF="Vector.html#setSize(int)">setSize</A>, <A HREF="Vector.html#size()">size</A>, <A HREF="Vector.html#subList(int, int)">subList</A>, <A HREF="Vector.html#toArray()">toArray</A>, <A HREF="Vector.html#toArray(T[])">toArray</A>, <A HREF="Vector.html#toString()">toString</A>, <A HREF="Vector.html#trimToSize()">trimToSize</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.util.AbstractList"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从类 java.util.<A HREF="AbstractList.html" title="java.util 中的类">AbstractList</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="AbstractList.html#iterator()">iterator</A>, <A HREF="AbstractList.html#listIterator()">listIterator</A>, <A HREF="AbstractList.html#listIterator(int)">listIterator</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从类 java.lang.<A HREF="../lang/Object.html" title="java.lang 中的类">Object</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../lang/Object.html#finalize()">finalize</A>, <A HREF="../lang/Object.html#getClass()">getClass</A>, <A HREF="../lang/Object.html#notify()">notify</A>, <A HREF="../lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../lang/Object.html#wait()">wait</A>, <A HREF="../lang/Object.html#wait(long)">wait</A>, <A HREF="../lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.util.List"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从接口 java.util.<A HREF="List.html" title="java.util 中的接口">List</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="List.html#iterator()">iterator</A>, <A HREF="List.html#listIterator()">listIterator</A>, <A HREF="List.html#listIterator(int)">listIterator</A></CODE></TD></TR></TABLE> <P><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>构造方法详细信息</B></FONT></TH></TR></TABLE><A NAME="Stack()"><!-- --></A><H3>Stack</H3><PRE>public <B>Stack</B>()</PRE><DL><DD>创建一个空 Stack。<P></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>方法详细信息</B></FONT></TH></TR></TABLE><A NAME="push(java.lang.Object)"><!-- --></A><A NAME="push(E)"><!-- --></A><H3>push</H3><PRE>public <A HREF="Stack.html" title="Stack 中的类型参数">E</A> <B>push</B>(<A HREF="Stack.html" title="Stack 中的类型参数">E</A> item)</PRE><DL><DD>把项压入栈顶。其作用和下面的方法相同: <blockquote><pre> addElement(item)</pre></blockquote><P><DD><DL><DT><B>参数:</B><DD><CODE>item</CODE> - 压入栈的项。<DT><B>返回:</B><DD><code>item</code> 参数。<DT><B>另请参见:</B><DD><A HREF="Vector.html#addElement(E)"><CODE>Vector.addElement(E)</CODE></A></DL></DD></DL><HR><A NAME="pop()"><!-- --></A><H3>pop</H3><PRE>public <A HREF="Stack.html" title="Stack 中的类型参数">E</A> <B>pop</B>()</PRE><DL><DD>移除栈顶对象并作为此函数的值返回该对象。<P><DD><DL><DT><B>返回:</B><DD>栈顶对象(<tt>Vector</tt> 对象中的最后一项)。<DT><B>抛出:</B><DD><CODE><A HREF="EmptyStackException.html" title="java.util 中的类">EmptyStackException</A></CODE> - 如果堆栈是空的。</DL></DD></DL><HR><A NAME="peek()"><!-- --></A><H3>peek</H3><PRE>public <A HREF="Stack.html" title="Stack 中的类型参数">E</A> <B>peek</B>()</PRE><DL><DD>查看栈顶对象而不移除它。<P><DD><DL><DT><B>返回:</B><DD>栈顶对象(<tt>Vector</tt> 对象中的最后一项)。<DT><B>抛出:</B><DD><CODE><A HREF="EmptyStackException.html" title="java.util 中的类">EmptyStackException</A></CODE> - 如果堆栈是空的。</DL></DD></DL><HR><A NAME="empty()"><!-- --></A><H3>empty</H3><PRE>public boolean <B>empty</B>()</PRE><DL><DD>测试堆栈是否为空。<P><DD><DL><DT><B>返回:</B><DD>当且仅当堆栈中不含任何项时返回 <code>true</code>;否则返回 <code>false</code>。</DL></DD></DL><HR><A NAME="search(java.lang.Object)"><!-- --></A><H3>search</H3><PRE>public int <B>search</B>(<A HREF="../lang/Object.html" title="java.lang 中的类">Object</A> o)</PRE><DL><DD>返回对象在栈中的位置,以 1 为基数。如果对象 <tt>o</tt> 是栈中的一个项,该方法返回距栈顶最近的出现位置到栈顶的距离;栈中最上端项的距离为 <tt>1</tt>。使用 <tt>equals</tt> 方法比较 <tt>o</tt> 与堆栈中的项。<P><DD><DL><DT><B>参数:</B><DD><CODE>o</CODE> - 目标对象。<DT><B>返回:</B><DD>对象到栈顶的位置,以 1 为基数;返回值 <code>-1</code> 表示此对象不在堆栈中。</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="跳过导航链接"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>类</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Stack.html"><FONT CLASS="NavBarFont1"><B>使用</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Standard Ed. 5.0</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="SortedSet.html" title="java.util 中的接口"><B>上一个类</B></A> <A HREF="StringTokenizer.html" title="java.util 中的类"><B>下一个类</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html@java_2Futil_2FStack.html" target="_top"><B>框架</B></A> <A HREF="Stack.html" target="_top"><B>无框架</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>所有类</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>所有类</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 摘要: 嵌套 | <A HREF="#fields_inherited_from_class_java.util.Vector">字段</A> | <A HREF="#constructor_summary">构造方法</A> | <A HREF="#method_summary">方法</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">详细信息: 字段 | <A HREF="#constructor_detail">构造方法</A> | <A HREF="#method_detail">方法</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1"><a href="../../../../../../../../java.sun.com/cgi-bin/bugreport.cgi">提交错误或意见</a><br>有关更多的 API 参考资料和开发人员文档,请参阅 <a href="../../../../../../../../java.sun.com/j2se/1.5.0/docs/relnotes/devdocs-vs-specs.html">Java 2 SDK SE 开发人员文档</a>。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。 <p>版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守<a href="../../../../../../../../java.sun.com/j2se/1.5.0/docs/relnotes/license.html">许可证条款</a>。另请参阅<a href="../../../../../../../../java.sun.com/docs/redist.html">文档重新分发政策</a>。</font></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?