mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8231800: Better listing of arrays
Reviewed-by: alanb, rhalade, ahgross, igerasim
This commit is contained in:
parent
0ffa6b75fd
commit
343ecd806b
5 changed files with 25 additions and 22 deletions
|
@ -263,8 +263,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
|
|||
private void initElementsFromCollection(Collection<? extends E> c) {
|
||||
Object[] es = c.toArray();
|
||||
int len = es.length;
|
||||
// If c.toArray incorrectly doesn't return Object[], copy it.
|
||||
if (es.getClass() != Object[].class)
|
||||
if (c.getClass() != ArrayList.class)
|
||||
es = Arrays.copyOf(es, len, Object[].class);
|
||||
if (len == 1 || this.comparator != null)
|
||||
for (Object e : es)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue