[cvs] / jsr166 / src / main / java / util / PriorityQueue.java Repository:
ViewVC logotype

Diff of /jsr166/src/main/java/util/PriorityQueue.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.41, Sat Sep 13 18:51:06 2003 UTC revision 1.42, Mon Sep 15 12:02:23 2003 UTC
# Line 14  Line 14 
14   * <i>natural order</i> (see {@link Comparable}), or according to a   * <i>natural order</i> (see {@link Comparable}), or according to a
15   * {@link java.util.Comparator}, depending on which constructor is   * {@link java.util.Comparator}, depending on which constructor is
16   * used. A priority queue does not permit <tt>null</tt> elements.   * used. A priority queue does not permit <tt>null</tt> elements.
17     * A priority queue relying on natural ordering also does not
18     * permit insertion of non-comparable objects (doing so results
19     * in <tt>ClassCastException</tt>).
20   *   *
21   * <p>The <em>head</em> of this queue is the <em>least</em> element   * <p>The <em>head</em> of this queue is the <em>least</em> element
22   * with respect to the specified ordering.  If multiple elements are   * with respect to the specified ordering.  If multiple elements are
23   * tied for least value, the head is one of those elements -- ties are   * tied for least value, the head is one of those elements -- ties are
24   * broken arbitrarily.  The {@link #remove()} and {@link #poll()}   * broken arbitrarily.  The queue retrieval operations <tt>poll</tt>,
25   * methods remove and return the head of the queue, and the {@link   * <tt>remove</tt>, <tt>peek</tt>, and <tt>element</tt> access the
26   * #element()} and {@link #peek()} methods return, but do not delete,   * element at the head of the queue.
  * the head of the queue.  
27   *   *
28   * <p>A priority queue is unbounded, but has an internal   * <p>A priority queue is unbounded, but has an internal
29   * <i>capacity</i> governing the size of an array used to store the   * <i>capacity</i> governing the size of an array used to store the
# Line 278  Line 280 
280    
281    
282      /**      /**
283       * Inserts the specified element to this priority queue.       * Inserts the specified element into this priority queue.
284       *       *
285       * @return <tt>true</tt>       * @return <tt>true</tt>
286       * @throws ClassCastException if the specified element cannot be compared       * @throws ClassCastException if the specified element cannot be compared
# Line 323  Line 325 
325          return offer(o);          return offer(o);
326      }      }
327    
   
     /**  
      * Adds all of the elements in the specified collection to this queue.  
      * The behavior of this operation is undefined if  
      * the specified collection is modified while the operation is in  
      * progress.  (This implies that the behavior of this call is undefined if  
      * the specified collection is this queue, and this queue is nonempty.)  
      * <p>  
      * This implementation iterates over the specified collection, and adds  
      * each object returned by the iterator to this collection, in turn.  
      * @param c collection whose elements are to be added to this queue  
      * @return <tt>true</tt> if this queue changed as a result of the  
      *         call.  
      * @throws NullPointerException if <tt>c</tt> or any element in <tt>c</tt>  
      * is <tt>null</tt>  
      * @throws ClassCastException if any element cannot be compared  
      * with elements currently in the priority queue according  
      * to the priority queue's ordering.  
      */  
     public boolean addAll(Collection<? extends E> c) {  
         return super.addAll(c);  
     }  
   
328      public boolean remove(Object o) {      public boolean remove(Object o) {
329          if (o == null)          if (o == null)
330              return false;              return false;

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8