1 |
|
/* |
2 |
|
* %W% %E% |
3 |
|
* |
4 |
< |
* Copyright 2005 Sun Microsystems, Inc. All rights reserved. |
4 |
> |
* Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
5 |
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
6 |
|
*/ |
7 |
|
|
8 |
|
package java.util; |
9 |
– |
import java.util.*; // for javadoc (till 6280605 is fixed) |
9 |
|
|
10 |
|
/** |
11 |
|
* The <code>Vector</code> class implements a growable array of |
146 |
|
* @since 1.2 |
147 |
|
*/ |
148 |
|
public Vector(Collection<? extends E> c) { |
149 |
< |
Object[] a = c.toArray(); |
150 |
< |
elementCount = a.length; |
151 |
< |
// If c.toArray incorrectly doesn't return Object[], copy it. |
152 |
< |
if (a.getClass() == Object[].class) |
153 |
< |
elementData = a; |
155 |
< |
else |
156 |
< |
elementData = Arrays.copyOf(a, a.length, Object[].class); |
149 |
> |
elementData = c.toArray(); |
150 |
> |
elementCount = elementData.length; |
151 |
> |
// c.toArray might (incorrectly) not return Object[] (see 6260652) |
152 |
> |
if (elementData.getClass() != Object[].class) |
153 |
> |
elementData = Arrays.copyOf(elementData, elementCount, Object[].class); |
154 |
|
} |
155 |
|
|
156 |
|
/** |