224 |
|
static void arrays() { |
225 |
|
List<Integer> l = newList(cl, synch); |
226 |
|
AddRandoms(l, listSize); |
227 |
< |
Integer[] ia = (Integer[]) l.toArray(new Integer[0]); |
227 |
> |
Integer[] ia = l.toArray(new Integer[0]); |
228 |
|
if (!l.equals(Arrays.asList(ia))) |
229 |
|
fail("toArray(Object[]) is hosed (1)"); |
230 |
|
ia = new Integer[listSize]; |
231 |
< |
Integer[] ib = (Integer[]) l.toArray(ia); |
231 |
> |
Integer[] ib = l.toArray(ia); |
232 |
|
if (ia != ib || !l.equals(Arrays.asList(ia))) |
233 |
|
fail("toArray(Object[]) is hosed (2)"); |
234 |
|
ia = new Integer[listSize+1]; |
235 |
|
ia[listSize] = new Integer(69); |
236 |
< |
ib = (Integer[]) l.toArray(ia); |
236 |
> |
ib = l.toArray(ia); |
237 |
|
if (ia != ib || ia[listSize] != null |
238 |
|
|| !l.equals(Arrays.asList(ia).subList(0, listSize))) |
239 |
|
fail("toArray(Object[]) is hosed (3)"); |
254 |
|
if (!clone.containsAll(s)) |
255 |
|
fail("Copy does not contain list."); |
256 |
|
|
257 |
< |
return (List<Integer>)clone; |
257 |
> |
return (List<Integer>) clone; |
258 |
|
} |
259 |
|
|
260 |
|
static List<Integer> newList(Class cl, boolean synch) { |
261 |
|
try { |
262 |
< |
List<Integer> s = (List<Integer>)cl.newInstance(); |
262 |
> |
List<Integer> s = (List<Integer>) cl.newInstance(); |
263 |
|
if (synch) |
264 |
|
s = Collections.synchronizedList(s); |
265 |
|
if (!s.isEmpty()) |