ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/PriorityQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/PriorityQueue.java (file contents):
Revision 1.24 by tim, Wed Aug 6 18:22:09 2003 UTC vs.
Revision 1.28 by dl, Wed Aug 13 14:11:59 2003 UTC

# Line 159 | Line 159 | public class PriorityQueue<E> extends Ab
159       * specified collection.  The priority queue has an initial
160       * capacity of 110% of the size of the specified collection or 1
161       * if the collection is empty.  If the specified collection is an
162 <     * instance of a {@link SortedSet} or is another
162 >     * instance of a {@link java.util.SortedSet} or is another
163       * <tt>PriorityQueue</tt>, the priority queue will be sorted
164       * according to the same comparator, or according to its elements'
165       * natural order if the collection is sorted according to its
# Line 176 | Line 176 | public class PriorityQueue<E> extends Ab
176       */
177      public PriorityQueue(Collection<? extends E> c) {
178          initializeArray(c);
179 <        if (c instanceof SortedSet<? extends E>) {
180 <            SortedSet<? extends E> s = (SortedSet<? extends E>) c;
179 >        if (c instanceof SortedSet) {
180 >            // @fixme double-cast workaround for compiler
181 >            SortedSet<? extends E> s = (SortedSet<? extends E>) (SortedSet)c;
182              comparator = (Comparator<? super E>)s.comparator();
183              fillFromSorted(s);
184 <        }
184 <        else if (c instanceof PriorityQueue<? extends E>) {
184 >        } else if (c instanceof PriorityQueue) {
185              PriorityQueue<? extends E> s = (PriorityQueue<? extends E>) c;
186              comparator = (Comparator<? super E>)s.comparator();
187              fillFromSorted(s);
188 <        }
189 <        else {
188 >        } else {
189              comparator = null;
190              fillFromUnsorted(c);
191          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines