summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2013-11-19 04:12:28 (EST)
committerGerrit Code Review @ Eclipse.org2013-11-19 06:57:14 (EST)
commit89e0dd988ea7152d2efff487a65d3c0e4d512f05 (patch)
tree3264eda5260006fc1c44a709728daa19fd807f96
parentdf8b3aceccc548666833df2ff68112fcb08838dd (diff)
downloadrt.equinox.p2-89e0dd988ea7152d2efff487a65d3c0e4d512f05.zip
rt.equinox.p2-89e0dd988ea7152d2efff487a65d3c0e4d512f05.tar.gz
rt.equinox.p2-89e0dd988ea7152d2efff487a65d3c0e4d512f05.tar.bz2
Bug 422032 - Generify comparator in SimpleConfiguratorManipulatorUtils.I20131119-0800refs/changes/49/18549/2
Make use of 1.5 features for simplicity and readability. Change-Id: I0c97b59a985bd953385008703c72b2bc2ae2ff1e Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorUtils.java19
1 files changed, 7 insertions, 12 deletions
diff --git a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorUtils.java b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorUtils.java
index c72ef35..73a1e71 100644
--- a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorUtils.java
+++ b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorUtils.java
@@ -60,18 +60,13 @@ public class SimpleConfiguratorManipulatorUtils {
*/
public static void writeConfiguration(BundleInfo[] simpleInfos, OutputStream stream) throws IOException {
// sort by symbolic name
- Arrays.sort(simpleInfos, new Comparator() {
- public int compare(Object o1, Object o2) {
- if (o1 instanceof BundleInfo && o2 instanceof BundleInfo) {
- BundleInfo b1 = (BundleInfo) o1;
- BundleInfo b2 = (BundleInfo) o2;
- int bsnComparison = b1.getSymbolicName().compareTo(b2.getSymbolicName());
- if (bsnComparison != 0)
- return bsnComparison;
- // prefer latest version, see https://bugs.eclipse.org/363590
- return new Version(b2.getVersion()).compareTo(new Version(b1.getVersion()));
- }
- return 0;
+ Arrays.sort(simpleInfos, new Comparator<BundleInfo>() {
+ public int compare(BundleInfo b1, BundleInfo b2) {
+ int bsnComparison = b1.getSymbolicName().compareTo(b2.getSymbolicName());
+ if (bsnComparison != 0)
+ return bsnComparison;
+ // prefer latest version, see https://bugs.eclipse.org/363590
+ return new Version(b2.getVersion()).compareTo(new Version(b1.getVersion()));
}
});