[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.9, Sun Jul 13 22:51:22 2003 UTC revision 1.10, Sat Jul 26 13:17:51 2003 UTC
# Line 97  Line 97 
97      public PriorityQueue(int initialCapacity, Comparator<E> comparator) {      public PriorityQueue(int initialCapacity, Comparator<E> comparator) {
98          if (initialCapacity < 1)          if (initialCapacity < 1)
99              initialCapacity = 1;              initialCapacity = 1;
100          queue = new E[initialCapacity + 1];          queue = (E[]) new Object[initialCapacity + 1];
101          this.comparator = comparator;          this.comparator = comparator;
102      }      }
103    
# Line 126  Line 126 
126                                              Integer.MAX_VALUE - 1);                                              Integer.MAX_VALUE - 1);
127          if (initialCapacity < 1)          if (initialCapacity < 1)
128              initialCapacity = 1;              initialCapacity = 1;
129          queue = new E[initialCapacity + 1];          queue = (E[]) new Object[initialCapacity + 1];
130    
131    
132          if (initialElements instanceof Sorted) {          if (initialElements instanceof Sorted) {
# Line 303  Line 303 
303    
304          // Grow backing store if necessary          // Grow backing store if necessary
305          while (size >= queue.length) {          while (size >= queue.length) {
306              E[] newQueue = new E[2 * queue.length];              E[] newQueue = (E[]) new Object[2 * queue.length];
307              System.arraycopy(queue, 0, newQueue, 0, queue.length);              System.arraycopy(queue, 0, newQueue, 0, queue.length);
308              queue = newQueue;              queue = newQueue;
309          }          }
# Line 451  Line 451 
451    
452          // Read in array length and allocate array          // Read in array length and allocate array
453          int arrayLength = s.readInt();          int arrayLength = s.readInt();
454          queue = new E[arrayLength];          queue = (E[]) new Object[arrayLength];
455    
456          // Read in all elements in the proper order.          // Read in all elements in the proper order.
457          for (int i=0; i<size; i++)          for (int i=0; i<size; i++)

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8