6 |
|
*/ |
7 |
|
|
8 |
|
package java.util; |
9 |
+ |
import java.util.*; // for javadoc |
10 |
|
import java.io.Serializable; |
11 |
|
import java.io.ObjectOutputStream; |
12 |
|
import java.io.IOException; |
1366 |
|
// We don't pass a to c.toArray, to avoid window of |
1367 |
|
// vulnerability wherein an unscrupulous multithreaded client |
1368 |
|
// could get his hands on raw (unwrapped) Entries from c. |
1369 |
< |
Object[] arr = |
1369 |
< |
c.toArray( |
1370 |
< |
a.length==0 ? a : |
1371 |
< |
(T[])java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), 0)); |
1369 |
> |
Object[] arr = c.toArray(a.length==0 ? a : Arrays.copyOf(a, 0)); |
1370 |
|
|
1371 |
|
for (int i=0; i<arr.length; i++) |
1372 |
|
arr[i] = new UnmodifiableEntry<K,V>((Map.Entry<K,V>)arr[i]); |
2700 |
|
// We don't pass a to s.toArray, to avoid window of |
2701 |
|
// vulnerability wherein an unscrupulous multithreaded client |
2702 |
|
// could get his hands on raw (unwrapped) Entries from s. |
2703 |
< |
Object[] arr = s.toArray(a.length==0 ? a : |
2706 |
< |
(T[])Array.newInstance(a.getClass().getComponentType(), 0)); |
2703 |
> |
Object[] arr = s.toArray(a.length==0 ? a : Arrays.copyOf(a, 0)); |
2704 |
|
|
2705 |
|
for (int i=0; i<arr.length; i++) |
2706 |
|
arr[i] = new CheckedEntry<K,V>((Map.Entry<K,V>)arr[i], |