147 |
|
* @since 1.2 |
148 |
|
*/ |
149 |
|
public Vector(Collection<? extends E> c) { |
150 |
< |
Object[] a = c.toArray(); |
151 |
< |
elementCount = a.length; |
152 |
< |
// If c.toArray incorrectly doesn't return Object[], copy it. |
153 |
< |
if (a.getClass() == Object[].class) |
154 |
< |
elementData = a; |
155 |
< |
else |
156 |
< |
elementData = Arrays.copyOf(a, a.length, Object[].class); |
150 |
> |
elementData = c.toArray(); |
151 |
> |
elementCount = elementData.length; |
152 |
> |
// c.toArray might (incorrectly) not return Object[] (see 6260652) |
153 |
> |
if (elementData.getClass() != Object[].class) |
154 |
> |
elementData = Arrays.copyOf(elementData, elementCount, Object[].class); |
155 |
|
} |
156 |
|
|
157 |
|
/** |