Use method reference instead of lambdas
Method references are slightly faster than lambdas and better readable.
Change-Id: I905142784bf92dce38491d360fb5ff7354483281
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledBundles.java b/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledBundles.java
index 2027c9d..d61a1fd 100644
--- a/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledBundles.java
+++ b/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledBundles.java
@@ -34,7 +34,7 @@
public void append(PrintWriter writer) {
Bundle[] bundles = FrameworkUtil.getBundle(InstalledBundles.class).getBundleContext().getBundles();
Map<String, String> headers = Arrays.stream(bundles).collect(
- Collectors.toMap(b -> identify(b), b -> name(b)));
+ Collectors.toMap(this::identify, this::name));
Arrays.stream(bundles).sorted(createComparator(headers)).forEach(b -> writeBundleInfo(writer, b));
}
diff --git a/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/PrintedMap.java b/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/PrintedMap.java
index 305d1bf..7d41980 100644
--- a/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/PrintedMap.java
+++ b/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/PrintedMap.java
@@ -25,7 +25,7 @@
@Override
public void append(PrintWriter writer) {
- source().entrySet().stream().flatMap(x -> mapEntry(x)).forEach((String s) -> writer.println(s));
+ source().entrySet().stream().flatMap(this::mapEntry).forEach((String s) -> writer.println(s));
}
protected abstract TreeMap<String, String> source();
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/about/BundleGroupFactory.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/about/BundleGroupFactory.java
index 7008f8d..98992bc 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/about/BundleGroupFactory.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/about/BundleGroupFactory.java
@@ -51,7 +51,7 @@
@Override
public IBundleGroup[] getBundleGroups() {
- return groups.stream().map(x -> x.create()).toArray(IBundleGroup[]::new);
+ return groups.stream().map(BundleGroupFactory::create).toArray(IBundleGroup[]::new);
}
};
}