Inline Collections.sort().
This commit is contained in:
parent
4984c96072
commit
8ea386b864
|
@ -1229,7 +1229,7 @@ public class CollectionUtilsTest extends MockTestCase {
|
||||||
|
|
||||||
final List<Integer> combinedList = new ArrayList<>(collectionD);
|
final List<Integer> combinedList = new ArrayList<>(collectionD);
|
||||||
combinedList.addAll(collectionE);
|
combinedList.addAll(collectionE);
|
||||||
Collections.sort(combinedList);
|
combinedList.sort(null);
|
||||||
|
|
||||||
assertEquals(combinedList, result2, "Merge two lists 2");
|
assertEquals(combinedList, result2, "Merge two lists 2");
|
||||||
|
|
||||||
|
@ -1258,7 +1258,7 @@ public class CollectionUtilsTest extends MockTestCase {
|
||||||
final Set<Integer> combinedSet = new HashSet<>(collectionD);
|
final Set<Integer> combinedSet = new HashSet<>(collectionD);
|
||||||
combinedSet.addAll(collectionE);
|
combinedSet.addAll(collectionE);
|
||||||
final List<Integer> combinedList = new ArrayList<>(combinedSet);
|
final List<Integer> combinedList = new ArrayList<>(combinedSet);
|
||||||
Collections.sort(combinedList);
|
combinedList.sort(null);
|
||||||
|
|
||||||
assertEquals(combinedList, result2, "Merge two lists 2 - ignore duplicates");
|
assertEquals(combinedList, result2, "Merge two lists 2 - ignore duplicates");
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ public class FluentIterableTest {
|
||||||
final List<Integer> combinedList = new ArrayList<>();
|
final List<Integer> combinedList = new ArrayList<>();
|
||||||
CollectionUtils.addAll(combinedList, iterableOdd);
|
CollectionUtils.addAll(combinedList, iterableOdd);
|
||||||
CollectionUtils.addAll(combinedList, iterableEven);
|
CollectionUtils.addAll(combinedList, iterableEven);
|
||||||
Collections.sort(combinedList);
|
combinedList.sort(null);
|
||||||
assertEquals(combinedList, result);
|
assertEquals(combinedList, result);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -183,7 +183,7 @@ public class FluentIterableTest {
|
||||||
final List<Integer> combinedList = new ArrayList<>();
|
final List<Integer> combinedList = new ArrayList<>();
|
||||||
CollectionUtils.addAll(combinedList, iterableOdd);
|
CollectionUtils.addAll(combinedList, iterableOdd);
|
||||||
CollectionUtils.addAll(combinedList, iterableEven);
|
CollectionUtils.addAll(combinedList, iterableEven);
|
||||||
Collections.sort(combinedList);
|
combinedList.sort(null);
|
||||||
assertEquals(combinedList, result);
|
assertEquals(combinedList, result);
|
||||||
|
|
||||||
// null comparator is equivalent to natural ordering
|
// null comparator is equivalent to natural ordering
|
||||||
|
@ -352,7 +352,7 @@ public class FluentIterableTest {
|
||||||
List<Integer> combinedList = new ArrayList<>();
|
List<Integer> combinedList = new ArrayList<>();
|
||||||
CollectionUtils.addAll(combinedList, iterableOdd);
|
CollectionUtils.addAll(combinedList, iterableOdd);
|
||||||
CollectionUtils.addAll(combinedList, iterableEven);
|
CollectionUtils.addAll(combinedList, iterableEven);
|
||||||
Collections.sort(combinedList);
|
combinedList.sort(null);
|
||||||
assertEquals(combinedList, result);
|
assertEquals(combinedList, result);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -579,7 +579,7 @@ public class IteratorUtilsTest {
|
||||||
|
|
||||||
final List<Integer> combinedList = new ArrayList<>(collectionOdd);
|
final List<Integer> combinedList = new ArrayList<>(collectionOdd);
|
||||||
combinedList.addAll(collectionEven);
|
combinedList.addAll(collectionEven);
|
||||||
Collections.sort(combinedList);
|
combinedList.sort(null);
|
||||||
|
|
||||||
assertEquals(combinedList, result);
|
assertEquals(combinedList, result);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public abstract class AbstractSortedBidiMapTest<K extends Comparable<K>, V exten
|
||||||
public AbstractSortedBidiMapTest(final String testName) {
|
public AbstractSortedBidiMapTest(final String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
sortedKeys = getAsList(getSampleKeys());
|
sortedKeys = getAsList(getSampleKeys());
|
||||||
Collections.sort(sortedKeys);
|
sortedKeys.sort(null);
|
||||||
sortedKeys = Collections.unmodifiableList(sortedKeys);
|
sortedKeys = Collections.unmodifiableList(sortedKeys);
|
||||||
|
|
||||||
final Map<K, V> map = new TreeMap<>();
|
final Map<K, V> map = new TreeMap<>();
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class DualTreeBidiMap2Test<K extends Comparable<K>, V extends Comparable<
|
||||||
|
|
||||||
// Sort by the comparator used in the makeEmptyBidiMap() method
|
// Sort by the comparator used in the makeEmptyBidiMap() method
|
||||||
List<K> newSortedKeys = getAsList(getSampleKeys());
|
List<K> newSortedKeys = getAsList(getSampleKeys());
|
||||||
Collections.sort(newSortedKeys, new ReverseComparator<>(ComparableComparator.<K>comparableComparator()));
|
newSortedKeys.sort(new ReverseComparator<>(ComparableComparator.<K>comparableComparator()));
|
||||||
newSortedKeys = Collections.unmodifiableList(newSortedKeys);
|
newSortedKeys = Collections.unmodifiableList(newSortedKeys);
|
||||||
|
|
||||||
final Iterator<K> mapIter = sm.keySet().iterator();
|
final Iterator<K> mapIter = sm.keySet().iterator();
|
||||||
|
|
|
@ -74,7 +74,7 @@ public abstract class AbstractAvailableLocalesTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(availableLocales, new ObjectToStringComparator());
|
availableLocales.sort(ObjectToStringComparator.INSTANCE);
|
||||||
return availableLocales;
|
return availableLocales;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public final class ObjectToStringComparator implements Comparator<Object>, Seria
|
||||||
*
|
*
|
||||||
* @since 4.5
|
* @since 4.5
|
||||||
*/
|
*/
|
||||||
public final ObjectToStringComparator INSTANCE = new ObjectToStringComparator();
|
public static final ObjectToStringComparator INSTANCE = new ObjectToStringComparator();
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public abstract class AbstractOrderedMapTest<K, V> extends AbstractIterableMapTe
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public K[] getSampleKeys() {
|
public K[] getSampleKeys() {
|
||||||
final List<K> list = new ArrayList<>(Arrays.asList(super.getSampleKeys()));
|
final List<K> list = new ArrayList<>(Arrays.asList(super.getSampleKeys()));
|
||||||
Collections.sort(list, new NullComparator<K>());
|
list.sort(new NullComparator<K>());
|
||||||
return (K[]) list.toArray();
|
return (K[]) list.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue