< prev index next >

src/java.base/share/classes/java/util/Queue.java

Print this page




  30  *
  31  * Written by Doug Lea with assistance from members of JCP JSR-166
  32  * Expert Group and released to the public domain, as explained at
  33  * http://creativecommons.org/publicdomain/zero/1.0/
  34  */
  35 
  36 package java.util;
  37 
  38 /**
  39  * A collection designed for holding elements prior to processing.
  40  * Besides basic {@link java.util.Collection Collection} operations,
  41  * queues provide additional insertion, extraction, and inspection
  42  * operations.  Each of these methods exists in two forms: one throws
  43  * an exception if the operation fails, the other returns a special
  44  * value (either {@code null} or {@code false}, depending on the
  45  * operation).  The latter form of the insert operation is designed
  46  * specifically for use with capacity-restricted {@code Queue}
  47  * implementations; in most implementations, insert operations cannot
  48  * fail.
  49  *
  50  * <table BORDER CELLPADDING=3 CELLSPACING=1>
  51  * <caption>Summary of Queue methods</caption>
  52  *  <tr>
  53  *    <td></td>
  54  *    <td style="text-align:center"><em>Throws exception</em></td>
  55  *    <td style="text-align:center"><em>Returns special value</em></td>
  56  *  </tr>
  57  *  <tr>
  58  *    <td><b>Insert</b></td>
  59  *    <td>{@link Queue#add add(e)}</td>
  60  *    <td>{@link Queue#offer offer(e)}</td>
  61  *  </tr>
  62  *  <tr>
  63  *    <td><b>Remove</b></td>
  64  *    <td>{@link Queue#remove remove()}</td>
  65  *    <td>{@link Queue#poll poll()}</td>
  66  *  </tr>
  67  *  <tr>
  68  *    <td><b>Examine</b></td>
  69  *    <td>{@link Queue#element element()}</td>
  70  *    <td>{@link Queue#peek peek()}</td>




  30  *
  31  * Written by Doug Lea with assistance from members of JCP JSR-166
  32  * Expert Group and released to the public domain, as explained at
  33  * http://creativecommons.org/publicdomain/zero/1.0/
  34  */
  35 
  36 package java.util;
  37 
  38 /**
  39  * A collection designed for holding elements prior to processing.
  40  * Besides basic {@link java.util.Collection Collection} operations,
  41  * queues provide additional insertion, extraction, and inspection
  42  * operations.  Each of these methods exists in two forms: one throws
  43  * an exception if the operation fails, the other returns a special
  44  * value (either {@code null} or {@code false}, depending on the
  45  * operation).  The latter form of the insert operation is designed
  46  * specifically for use with capacity-restricted {@code Queue}
  47  * implementations; in most implementations, insert operations cannot
  48  * fail.
  49  *
  50  * <table class="plain">
  51  * <caption>Summary of Queue methods</caption>
  52  *  <tr>
  53  *    <td></td>
  54  *    <td style="text-align:center"><em>Throws exception</em></td>
  55  *    <td style="text-align:center"><em>Returns special value</em></td>
  56  *  </tr>
  57  *  <tr>
  58  *    <td><b>Insert</b></td>
  59  *    <td>{@link Queue#add add(e)}</td>
  60  *    <td>{@link Queue#offer offer(e)}</td>
  61  *  </tr>
  62  *  <tr>
  63  *    <td><b>Remove</b></td>
  64  *    <td>{@link Queue#remove remove()}</td>
  65  *    <td>{@link Queue#poll poll()}</td>
  66  *  </tr>
  67  *  <tr>
  68  *    <td><b>Examine</b></td>
  69  *    <td>{@link Queue#element element()}</td>
  70  *    <td>{@link Queue#peek peek()}</td>


< prev index next >