linkedblockingqueue.html

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

HTML
814 行
字号
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#offer(E, long, java.util.concurrent.TimeUnit)">offer</A></B>(<A HREF="LinkedBlockingQueue.html" title="LinkedBlockingQueue 中的类型参数">E</A>&nbsp;o,      long&nbsp;timeout,      <A HREF="TimeUnit.html" title="java.util.concurrent 中的枚举">TimeUnit</A>&nbsp;unit)</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="LinkedBlockingQueue.html" title="LinkedBlockingQueue 中的类型参数">E</A></CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#peek()">peek</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;检索,但是不移除此队列的头,如果此队列为空,则返回 <tt>null</tt>。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="LinkedBlockingQueue.html" title="LinkedBlockingQueue 中的类型参数">E</A></CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#poll()">poll</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;检索并移除此队列的头,如果此队列为空,则返回 <tt>null</tt>。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="LinkedBlockingQueue.html" title="LinkedBlockingQueue 中的类型参数">E</A></CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#poll(long, java.util.concurrent.TimeUnit)">poll</A></B>(long&nbsp;timeout,     <A HREF="TimeUnit.html" title="java.util.concurrent 中的枚举">TimeUnit</A>&nbsp;unit)</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;void</CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#put(E)">put</A></B>(<A HREF="LinkedBlockingQueue.html" title="LinkedBlockingQueue 中的类型参数">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;int</CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#remainingCapacity()">remainingCapacity</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;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#remove(java.lang.Object)">remove</A></B>(<A HREF="../../lang/Object.html" title="java.lang 中的类">Object</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;int</CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#size()">size</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="LinkedBlockingQueue.html" title="LinkedBlockingQueue 中的类型参数">E</A></CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#take()">take</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="../../lang/Object.html" title="java.lang 中的类">Object</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#toArray()">toArray</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><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""><TR ALIGN="right" VALIGN=""><TD NOWRAP><FONT SIZE="-1"><CODE>&lt;T&gt; T[]</CODE></FONT></TD></TR></TABLE></CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#toArray(T[])">toArray</A></B>(T[]&nbsp;a)</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="../../lang/String.html" title="java.lang 中的类">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="LinkedBlockingQueue.html#toString()">toString</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回此 collection 的字符串表示形式。</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.util.AbstractQueue"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从类 java.util.<A HREF="../AbstractQueue.html" title="java.util 中的类">AbstractQueue</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../AbstractQueue.html#add(E)">add</A>, <A HREF="../AbstractQueue.html#addAll(java.util.Collection)">addAll</A>, <A HREF="../AbstractQueue.html#element()">element</A>, <A HREF="../AbstractQueue.html#remove()">remove</A></CODE></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#removeAll(java.util.Collection)">removeAll</A>, <A HREF="../AbstractCollection.html#retainAll(java.util.Collection)">retainAll</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>&nbsp;<A NAME="methods_inherited_from_class_java.util.concurrent.BlockingQueue"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从接口 java.util.concurrent.<A HREF="BlockingQueue.html" title="java.util.concurrent 中的接口">BlockingQueue</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="BlockingQueue.html#add(E)">add</A></CODE></TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.util.Queue"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从接口 java.util.<A HREF="../Queue.html" title="java.util 中的接口">Queue</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../Queue.html#element()">element</A>, <A HREF="../Queue.html#remove()">remove</A></CODE></TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.util.Collection"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从接口 java.util.<A HREF="../Collection.html" title="java.util 中的接口">Collection</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../Collection.html#addAll(java.util.Collection)">addAll</A>, <A HREF="../Collection.html#contains(java.lang.Object)">contains</A>, <A HREF="../Collection.html#containsAll(java.util.Collection)">containsAll</A>, <A HREF="../Collection.html#equals(java.lang.Object)">equals</A>, <A HREF="../Collection.html#hashCode()">hashCode</A>, <A HREF="../Collection.html#isEmpty()">isEmpty</A>, <A HREF="../Collection.html#removeAll(java.util.Collection)">removeAll</A>, <A HREF="../Collection.html#retainAll(java.util.Collection)">retainAll</A></CODE></TD></TR></TABLE>&nbsp;<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="LinkedBlockingQueue()"><!-- --></A><H3>LinkedBlockingQueue</H3><PRE>public <B>LinkedBlockingQueue</B>()</PRE><DL><DD>创建一个容量为 <A HREF="../../lang/Integer.html#MAX_VALUE"><CODE>Integer.MAX_VALUE</CODE></A> 的 <tt>LinkedBlockingQueue</tt>。<P></DL><HR><A NAME="LinkedBlockingQueue(int)"><!-- --></A><H3>LinkedBlockingQueue</H3><PRE>public <B>LinkedBlockingQueue</B>(int&nbsp;capacity)</PRE><DL><DD>创建一个具有给定(固定)容量的 <tt>LinkedBlockingQueue</tt>。<P><DL><DT><B>参数:</B><DD><CODE>capacity</CODE> - 队列的容量。<DT><B>抛出:</B><DD><CODE><A HREF="../../lang/IllegalArgumentException.html" title="java.lang 中的类">IllegalArgumentException</A></CODE> - 如果 <tt>capacity</tt> 未大于 0。</DL></DL><HR><A NAME="LinkedBlockingQueue(java.util.Collection)"><!-- --></A><H3>LinkedBlockingQueue</H3><PRE>public <B>LinkedBlockingQueue</B>(<A HREF="../Collection.html" title="java.util 中的接口">Collection</A>&lt;? extends <A HREF="LinkedBlockingQueue.html" title="LinkedBlockingQueue 中的类型参数">E</A>&gt;&nbsp;c)</PRE><DL><DD>创建一个容量是 <A HREF="../../lang/Integer.html#MAX_VALUE"><CODE>Integer.MAX_VALUE</CODE></A> 的 <tt>LinkedBlockingQueue</tt>,最初包含给定集合的元素,元素按该集合迭代器的遍历顺序添加。<P>

⌨️ 快捷键说明

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