Replace Collection.sort with List.sort in Platform Runtime
Improves the readability by utilizing the Java 8 extensions of the List
API.
jSparrow Clean Up.
Change-Id: Iba843fb730a267a7b7b60fd259396efff0dfdc5d
Signed-off-by: Ardit Ymeri <ardit.ymeri@splendit.at>
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
index f2b0fba..7ec5ccd 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
@@ -28,6 +28,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -381,11 +382,7 @@
// Sort the constructors by descending number of constructor arguments
ArrayList<Constructor<?>> sortedConstructors = new ArrayList<>(constructors.length);
sortedConstructors.addAll(Arrays.asList(constructors));
- Collections.sort(sortedConstructors, (c1, c2) -> {
- int l1 = c1.getParameterTypes().length;
- int l2 = c2.getParameterTypes().length;
- return l2 - l1;
- });
+ sortedConstructors.sort(Comparator.comparing(c -> c.getParameterTypes().length, Comparator.reverseOrder()));
for (Constructor<?> constructor : sortedConstructors) {
// skip private and protected constructors; allow public and package visibility