129 |
|
initialCapacity = 1; |
130 |
|
queue = new E[initialCapacity + 1]; |
131 |
|
|
132 |
– |
/* Commented out to compile with generics compiler |
133 |
– |
|
132 |
|
if (initialElements instanceof Sorted) { |
133 |
|
comparator = ((Sorted)initialElements).comparator(); |
134 |
|
for (Iterator<E> i = initialElements.iterator(); i.hasNext(); ) |
135 |
|
queue[++size] = i.next(); |
136 |
|
} else { |
139 |
– |
*/ |
140 |
– |
{ |
137 |
|
comparator = null; |
138 |
|
for (Iterator<E> i = initialElements.iterator(); i.hasNext(); ) |
139 |
|
add(i.next()); |
408 |
|
* @return the comparator associated with this priority queue, or |
409 |
|
* <tt>null</tt> if it uses its elements' natural ordering. |
410 |
|
*/ |
411 |
< |
Comparator comparator() { |
411 |
> |
Comparator<E> comparator() { |
412 |
|
return comparator; |
413 |
|
} |
414 |
|
} |