[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.7, Tue Jun 24 14:34:30 2003 UTC revision 1.8, Tue Jul 1 16:29:45 2003 UTC
# Line 31  Line 31 
31   * @author Josh Bloch   * @author Josh Bloch
32   */   */
33  public class PriorityQueue<E> extends AbstractQueue<E>  public class PriorityQueue<E> extends AbstractQueue<E>
34                                implements Queue<E> {                                implements Queue<E>,
35                                             java.io.Serializable {
36      private static final int DEFAULT_INITIAL_CAPACITY = 11;      private static final int DEFAULT_INITIAL_CAPACITY = 11;
37    
38      /**      /**
# Line 127  Line 128 
128              initialCapacity = 1;              initialCapacity = 1;
129          queue = new E[initialCapacity + 1];          queue = new E[initialCapacity + 1];
130    
         /* Commented out to compile with generics compiler  
131    
132          if (initialElements instanceof Sorted) {          if (initialElements instanceof Sorted) {
133              comparator = ((Sorted)initialElements).comparator();              comparator = ((Sorted)initialElements).comparator();
134              for (Iterator<E> i = initialElements.iterator(); i.hasNext(); )              for (Iterator<E> i = initialElements.iterator(); i.hasNext(); )
135                  queue[++size] = i.next();                  queue[++size] = i.next();
136          } else {          } else {
         */  
         {  
137              comparator = null;              comparator = null;
138              for (Iterator<E> i = initialElements.iterator(); i.hasNext(); )              for (Iterator<E> i = initialElements.iterator(); i.hasNext(); )
139                  add(i.next());                  add(i.next());
# Line 414  Line 412 
412       * @return the comparator associated with this priority queue, or       * @return the comparator associated with this priority queue, or
413       *         <tt>null</tt> if it uses its elements' natural ordering.       *         <tt>null</tt> if it uses its elements' natural ordering.
414       */       */
415      Comparator comparator() {      public Comparator comparator() {
416          return comparator;          return comparator;
417      }      }
418    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8