27 |
|
* @summary A null Comparator is now specified to indicate natural ordering. |
28 |
|
*/ |
29 |
|
|
30 |
< |
import java.util.*; |
30 |
> |
import java.util.ArrayList; |
31 |
> |
import java.util.Arrays; |
32 |
> |
import java.util.Collections; |
33 |
> |
import java.util.List; |
34 |
|
|
35 |
|
public class NullComparator { |
36 |
|
public static void main(String[] args) throws Exception { |
40 |
|
List sorted = new ArrayList(list); |
41 |
|
Collections.shuffle(list); |
42 |
|
|
43 |
< |
Object a[] = list.toArray(); |
43 |
> |
Object[] a = list.toArray(); |
44 |
|
Arrays.sort(a, null); |
45 |
|
if (!Arrays.asList(a).equals(sorted)) |
46 |
|
throw new Exception("Arrays.sort"); |