test/java/util/Collection/ListDefaults.java
Print this page
rev 7485 : 8009736: Comparator API cleanup
Reviewed-by:
Contributed-by: henry.jen@oracle.com
@@ -23,11 +23,10 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
-import java.util.Comparators;
import java.util.List;
import java.util.LinkedList;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;
@@ -335,27 +334,27 @@
}
CollectionAsserts.assertContents(list, original);
CollectionSupplier.shuffle(list);
list.sort(null);
- CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
if (test.name.startsWith("reverse")) {
Collections.reverse(list);
}
CollectionAsserts.assertContents(list, original);
CollectionSupplier.shuffle(list);
- list.sort(Comparators.<Integer>naturalOrder());
- CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+ list.sort(Comparator.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
if (test.name.startsWith("reverse")) {
Collections.reverse(list);
}
CollectionAsserts.assertContents(list, original);
CollectionSupplier.shuffle(list);
- list.sort(Comparators.<Integer>reverseOrder());
- CollectionAsserts.assertSorted(list, Comparators.<Integer>reverseOrder());
+ list.sort(Comparator.<Integer>reverseOrder());
+ CollectionAsserts.assertSorted(list, Comparator.<Integer>reverseOrder());
if (!test.name.startsWith("reverse")) {
Collections.reverse(list);
}
CollectionAsserts.assertContents(list, original);
@@ -388,12 +387,12 @@
if (original.size() > SUBLIST_SIZE) {
final List<Integer> copy = new ArrayList<>(list);
final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
CollectionSupplier.shuffle(subList);
- subList.sort(Comparators.<Integer>naturalOrder());
- CollectionAsserts.assertSorted(subList, Comparators.<Integer>naturalOrder());
+ subList.sort(Comparator.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(subList, Comparator.<Integer>naturalOrder());
// verify that elements [0, from) remain unmodified
for (int i = 0; i < SUBLIST_FROM; i++) {
assertTrue(list.get(i) == copy.get(i),
"mismatch at index " + i);
}
@@ -410,12 +409,12 @@
trimmedSubList(list, new Callback() {
@Override
public void call(final List<Integer> list) {
final List<Integer> copy = new ArrayList<>(list);
CollectionSupplier.shuffle(list);
- list.sort(Comparators.<Integer>naturalOrder());
- CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+ list.sort(Comparator.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
}
});
}
}