Convert to lambda or member reference

Convert anonymous inner classes to lambda expressions or member
references.

Change-Id: I9f0cc7d4e0457bbdc64355b71ddfc77abe9b4901
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
diff --git a/bundles/org.eclipse.equinox.log.stream/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.log.stream/META-INF/MANIFEST.MF
index 07650d1..7587453 100644
--- a/bundles/org.eclipse.equinox.log.stream/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.log.stream/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
 Bundle-Name: %bundleName
 Bundle-Vendor: %bundleVendor
 Bundle-SymbolicName: org.eclipse.equinox.log.stream
-Bundle-Version: 1.0.100.qualifier
+Bundle-Version: 1.0.200.qualifier
 Bundle-Activator: org.eclipse.equinox.internal.log.stream.LogStreamManager
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.equinox.log.stream/pom.xml b/bundles/org.eclipse.equinox.log.stream/pom.xml
index a3391e2..e1d878b 100644
--- a/bundles/org.eclipse.equinox.log.stream/pom.xml
+++ b/bundles/org.eclipse.equinox.log.stream/pom.xml
@@ -19,7 +19,7 @@
   </parent>
   <groupId>org.eclipse.equinox</groupId>
   <artifactId>org.eclipse.equinox.log.stream</artifactId>
-  <version>1.0.100-SNAPSHOT</version>
+  <version>1.0.200-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <build>
diff --git a/bundles/org.eclipse.equinox.log.stream/src/org/eclipse/equinox/internal/log/stream/LogStreamProviderFactory.java b/bundles/org.eclipse.equinox.log.stream/src/org/eclipse/equinox/internal/log/stream/LogStreamProviderFactory.java
index 511f67d..3ec523d 100644
--- a/bundles/org.eclipse.equinox.log.stream/src/org/eclipse/equinox/internal/log/stream/LogStreamProviderFactory.java
+++ b/bundles/org.eclipse.equinox.log.stream/src/org/eclipse/equinox/internal/log/stream/LogStreamProviderFactory.java
@@ -7,7 +7,7 @@
  * https://www.eclipse.org/legal/epl-2.0/
  *
  * SPDX-License-Identifier: EPL-2.0
- * 
+ *
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *******************************************************************************/
@@ -17,7 +17,6 @@
 import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import org.osgi.framework.Bundle;
@@ -35,13 +34,10 @@
 	ServiceTracker<LogReaderService, AtomicReference<LogReaderService>> logReaderService;
 
 	private final int cores = Runtime.getRuntime().availableProcessors();
-	private final ExecutorService executor = Executors.newFixedThreadPool(cores, new ThreadFactory() {
-		@Override
-		public Thread newThread(Runnable r) {
-			Thread t = new Thread(r, "LogStream thread"); //$NON-NLS-1$
-			t.setDaemon(true);
-			return t;
-		}
+	private final ExecutorService executor = Executors.newFixedThreadPool(cores, (Runnable r) -> {
+		Thread t = new Thread(r, "LogStream thread"); //$NON-NLS-1$
+		t.setDaemon(true);
+		return t;
 	});
 
 	public LogStreamProviderFactory(ServiceTracker<LogReaderService, AtomicReference<LogReaderService>> logReaderService) {
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
index f47b4e9..07aadc2 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
@@ -1220,22 +1220,19 @@
 
 	public String toDeepDebugString() {
 		final StringBuffer buffer = new StringBuffer();
-		IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
-			@Override
-			public boolean visit(IEclipsePreferences node) throws BackingStoreException {
-				buffer.append(node);
+		IPreferenceNodeVisitor visitor = (IEclipsePreferences node) -> {
+			buffer.append(node);
+			buffer.append('\n');
+			String[] keys = node.keys();
+			for (String key : keys) {
+				buffer.append(node.absolutePath());
+				buffer.append(PATH_SEPARATOR);
+				buffer.append(key);
+				buffer.append('=');
+				buffer.append(node.get(key, "*default*")); //$NON-NLS-1$
 				buffer.append('\n');
-				String[] keys = node.keys();
-				for (String key : keys) {
-					buffer.append(node.absolutePath());
-					buffer.append(PATH_SEPARATOR);
-					buffer.append(key);
-					buffer.append('=');
-					buffer.append(node.get(key, "*default*")); //$NON-NLS-1$
-					buffer.append('\n');
-				}
-				return true;
 			}
+			return true;
 		};
 		try {
 			accept(visitor);
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java
index 674860c..205b92d 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java
@@ -44,13 +44,10 @@
 
 	@Override
 	public Set<Entry<Object, Object>> entrySet() {
-		TreeSet<Entry<Object, Object>> set = new TreeSet<>(new Comparator<Entry<Object, Object>>() {
-			@Override
-			public int compare(Entry<Object, Object> e1, Entry<Object, Object> e2) {
-				String s1 = (String) e1.getKey();
-				String s2 = (String) e2.getKey();
-				return s1.compareTo(s2);
-			}
+		TreeSet<Entry<Object, Object>> set = new TreeSet<>((Entry<Object, Object> e1, Entry<Object, Object> e2) -> {
+			String s1 = (String) e1.getKey();
+			String s2 = (String) e2.getKey();
+			return s1.compareTo(s2);
 		});
 		for (Iterator<Entry<Object, Object>> i = super.entrySet().iterator(); i.hasNext();) {
 			set.add(i.next());
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
index 445ad80..25f44b8 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
@@ -741,12 +741,7 @@
 		}
 
 		if (debugEvents())
-			addRegistryChangeListener(new IRegistryChangeListener() {
-				@Override
-				public void registryChanged(IRegistryChangeEvent event) {
-					System.out.println(event);
-				}
-			});
+			addRegistryChangeListener(System.out::println);
 
 		// Do extra start processing if specified in the registry strategy
 		strategy.onStart(this); // preserve for backward compatibility; might be removed later
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java
index 9f2571b..4f19d62 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java
@@ -59,12 +59,9 @@
 		try {
 			// Wrap BundleContext into an inner class to make sure it will only get loaded
 			// if OSGi layer is present.
-			Runnable innerClass = new Runnable() {
-				@Override
-				public void run() {
-					org.osgi.framework.BundleContext bundleContext = (org.osgi.framework.BundleContext) context;
-					result[0] = bundleContext.getProperty(propertyName);
-				}
+			Runnable innerClass = () -> {
+				org.osgi.framework.BundleContext bundleContext = (org.osgi.framework.BundleContext) context;
+				result[0] = bundleContext.getProperty(propertyName);
 			};
 			innerClass.run();
 		} catch (Exception e) {
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java
index dee661b..c36520a 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java
@@ -259,12 +259,7 @@
 	 * @return a filter
 	 */
 	public static IFilter createExtensionPointFilter(final IExtensionPoint xpt) {
-		return new IFilter() {
-			@Override
-			public boolean matches(IExtensionPoint target) {
-				return xpt.equals(target);
-			}
-		};
+		return xpt::equals;
 	}
 
 	/**
@@ -274,16 +269,13 @@
 	 * @return a filter
 	 */
 	public static IFilter createExtensionPointFilter(final IExtensionPoint[] xpts) {
-		return new IFilter() {
-			@Override
-			public boolean matches(IExtensionPoint target) {
-				for (IExtensionPoint xpt : xpts) {
-					if (xpt.equals(target)) {
-						return true;
-					}
+		return (IExtensionPoint target) -> {
+			for (IExtensionPoint xpt : xpts) {
+				if (xpt.equals(target)) {
+					return true;
 				}
-				return false;
 			}
+			return false;
 		};
 	}
 
@@ -294,12 +286,7 @@
 	 * @return a filter
 	 */
 	public static IFilter createNamespaceFilter(final String id) {
-		return new IFilter() {
-			@Override
-			public boolean matches(IExtensionPoint target) {
-				return id.equals(target.getNamespaceIdentifier());
-			}
-		};
+		return (IExtensionPoint target) -> id.equals(target.getNamespaceIdentifier());
 	}
 
 	private class HandlerWrapper {