abstractqueue.html

来自「j2se5-api-zh,java文档的中文版本」· HTML 代码 · 共 421 行 · 第 1/2 页

HTML
421
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_03) on Wed Nov 02 09:50:28 CST 2005 --><META http-equiv="Content-Type" content="text/html; charset=gb2312"><TITLE>AbstractQueue (Java 2 Platform SE 5.0)</TITLE><META NAME="keywords" CONTENT="java.util.AbstractQueue class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="AbstractQueue (Java 2 Platform SE 5.0)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="跳过导航链接"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>类</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/AbstractQueue.html"><FONT CLASS="NavBarFont1"><B>使用</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Standard&nbsp;Ed. 5.0</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="AbstractMap.html" title="java.util 中的类"><B>上一个类</B></A>&nbsp;&nbsp;<A HREF="AbstractSequentialList.html" title="java.util 中的类"><B>下一个类</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html@java_2Futil_2FAbstractQueue.html" target="_top"><B>框架</B></A>  &nbsp;&nbsp;<A HREF="AbstractQueue.html" target="_top"><B>无框架</B></A>  &nbsp;&nbsp;<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">  摘要:&nbsp;嵌套&nbsp;|&nbsp;字段&nbsp;|&nbsp;<A HREF="#constructor_summary">构造方法</A>&nbsp;|&nbsp;<A HREF="#method_summary">方法</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">详细信息:&nbsp;字段&nbsp;|&nbsp;<A HREF="#constructor_detail">构造方法</A>&nbsp;|&nbsp;<A HREF="#method_detail">方法</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.util</FONT><BR>类 AbstractQueue&lt;E&gt;</H2><PRE><A HREF="../lang/Object.html" title="java.lang 中的类">java.lang.Object</A>  <IMG SRC="../../resources/inherit.gif" ALT="继承者 "><A HREF="AbstractCollection.html" title="java.util 中的类">java.util.AbstractCollection</A>&lt;E&gt;      <IMG SRC="../../resources/inherit.gif" ALT="继承者 "><B>java.util.AbstractQueue&lt;E&gt;</B></PRE><DL><DT><DT><B>类型参数:</B><DD><CODE>E</CODE> - 此 collection 中所保存元素的类型</DL><DL><DT><B>所有已实现的接口:</B> <DD><A HREF="../lang/Iterable.html" title="java.lang 中的接口">Iterable</A>&lt;E&gt;, <A HREF="Collection.html" title="java.util 中的接口">Collection</A>&lt;E&gt;, <A HREF="Queue.html" title="java.util 中的接口">Queue</A>&lt;E&gt;</DD></DL><DL><DT><B>直接已知子类:</B> <DD><A HREF="concurrent/ArrayBlockingQueue.html" title="java.util.concurrent 中的类">ArrayBlockingQueue</A>, <A HREF="concurrent/ConcurrentLinkedQueue.html" title="java.util.concurrent 中的类">ConcurrentLinkedQueue</A>, <A HREF="concurrent/DelayQueue.html" title="java.util.concurrent 中的类">DelayQueue</A>, <A HREF="concurrent/LinkedBlockingQueue.html" title="java.util.concurrent 中的类">LinkedBlockingQueue</A>, <A HREF="concurrent/PriorityBlockingQueue.html" title="java.util.concurrent 中的类">PriorityBlockingQueue</A>, <A HREF="PriorityQueue.html" title="java.util 中的类">PriorityQueue</A>, <A HREF="concurrent/SynchronousQueue.html" title="java.util.concurrent 中的类">SynchronousQueue</A></DD></DL><HR><DL><DT><PRE>public abstract class <B>AbstractQueue&lt;E&gt;</B><DT>extends <A HREF="AbstractCollection.html" title="java.util 中的类">AbstractCollection</A>&lt;E&gt;<DT>implements <A HREF="Queue.html" title="java.util 中的接口">Queue</A>&lt;E&gt;</DL></PRE><P>此类提供某些 <A HREF="Queue.html" title="java.util 中的接口"><CODE>Queue</CODE></A> 操作的骨干实现。此类中的实现适用于基本实现<em>不</em> 允许包含 <tt>null</tt> 元素时。<A HREF="AbstractQueue.html#add(E)"><CODE>add</CODE></A>、<A HREF="AbstractQueue.html#remove()"><CODE>remove</CODE></A> 和 <A HREF="AbstractQueue.html#element()"><CODE>element</CODE></A> 方法分别基于 <A HREF="Queue.html#offer(E)"><CODE>offer</CODE></A>、<A HREF="Queue.html#poll()"><CODE>poll</CODE></A> 和 <A HREF="Queue.html#peek()"><CODE>peek</CODE></A> 方法,但是它们通过抛出异常而不是返回 <tt>false</tt> 或 <tt>null</tt> 来指示失败。<p> 扩展此类的 <tt>Queue</tt> 实现至少必须定义一个不允许插入 <tt>null</tt> 元素的 <A HREF="Queue.html#offer(E)"><CODE>Queue.offer(E)</CODE></A> 方法,该方法以及 <A HREF="Queue.html#peek()"><CODE>Queue.peek()</CODE></A>、<A HREF="Queue.html#poll()"><CODE>Queue.poll()</CODE></A>、<A HREF="Collection.html#size()"><CODE>Collection.size()</CODE></A> 和 <A HREF="Collection.html#iterator()"><CODE>Collection.iterator()</CODE></A> 都支持 <A HREF="Iterator.html#remove()"><CODE>Iterator.remove()</CODE></A> 方法。通常还要重写其他方法。如果无法满足这些要求,那么可以转而考虑为 <A HREF="AbstractCollection.html" title="java.util 中的类"><CODE>AbstractCollection</CODE></A> 创建子类。<p>此类是 <a href="../../../guide/collections/index.html">Java Collections Framework</a> 的成员。<P><P><DL><DT><B>从以下版本开始:</B></DT>  <DD>1.5</DD></DL><HR><P><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>构造方法摘要</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected </CODE></FONT></TD><TD><CODE><B><A HREF="AbstractQueue.html#AbstractQueue()">AbstractQueue</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;子类使用的构造方法。</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>方法摘要</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="AbstractQueue.html#add(E)">add</A></B>(<A HREF="AbstractQueue.html" title="AbstractQueue 中的类型参数">E</A>&nbsp;o)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;将指定的元素添加到此队列中。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="AbstractQueue.html#addAll(java.util.Collection)">addAll</A></B>(<A HREF="Collection.html" title="java.util 中的接口">Collection</A>&lt;? extends <A HREF="AbstractQueue.html" title="AbstractQueue 中的类型参数">E</A>&gt;&nbsp;c)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;将指定 collection 中的所有元素都添加到此队列中。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="AbstractQueue.html#clear()">clear</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;移除此 collection 中的所有元素。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="AbstractQueue.html" title="AbstractQueue 中的类型参数">E</A></CODE></FONT></TD><TD><CODE><B><A HREF="AbstractQueue.html#element()">element</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;检索但不移除此队列的头。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="AbstractQueue.html" title="AbstractQueue 中的类型参数">E</A></CODE></FONT></TD><TD><CODE><B><A HREF="AbstractQueue.html#remove()">remove</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;检索并移除此队列的头。</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.util.AbstractCollection"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从类 java.util.<A HREF="AbstractCollection.html" title="java.util 中的类">AbstractCollection</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="AbstractCollection.html#contains(java.lang.Object)">contains</A>, <A HREF="AbstractCollection.html#containsAll(java.util.Collection)">containsAll</A>, <A HREF="AbstractCollection.html#isEmpty()">isEmpty</A>, <A HREF="AbstractCollection.html#iterator()">iterator</A>, <A HREF="AbstractCollection.html#remove(java.lang.Object)">remove</A>, <A HREF="AbstractCollection.html#removeAll(java.util.Collection)">removeAll</A>, <A HREF="AbstractCollection.html#retainAll(java.util.Collection)">retainAll</A>, <A HREF="AbstractCollection.html#size()">size</A>, <A HREF="AbstractCollection.html#toArray()">toArray</A>, <A HREF="AbstractCollection.html#toArray(T[])">toArray</A>, <A HREF="AbstractCollection.html#toString()">toString</A></CODE></TD></TR></TABLE>&nbsp;<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#clone()">clone</A>, <A HREF="../lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../lang/Object.html#finalize()">finalize</A>, <A HREF="../lang/Object.html#getClass()">getClass</A>, <A HREF="../lang/Object.html#hashCode()">hashCode</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>

⌨️ 快捷键说明

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