111 |
|
* The comparator, or null if priority queue uses elements' |
112 |
|
* natural ordering. |
113 |
|
*/ |
114 |
+ |
@SuppressWarnings("serial") // Conditionally serializable |
115 |
|
private final Comparator<? super E> comparator; |
116 |
|
|
117 |
|
/** |
263 |
|
private void initElementsFromCollection(Collection<? extends E> c) { |
264 |
|
Object[] es = c.toArray(); |
265 |
|
int len = es.length; |
266 |
< |
// If c.toArray incorrectly doesn't return Object[], copy it. |
266 |
< |
if (es.getClass() != Object[].class) |
266 |
> |
if (c.getClass() != ArrayList.class) |
267 |
|
es = Arrays.copyOf(es, len, Object[].class); |
268 |
|
if (len == 1 || this.comparator != null) |
269 |
|
for (Object e : es) |