Clean up lambdas 50/55250/3
authorStephen Kitt <skitt@redhat.com>
Wed, 19 Apr 2017 16:52:27 +0000 (18:52 +0200)
committerRobert Varga <nite@hq.sk>
Sat, 22 Apr 2017 19:58:54 +0000 (19:58 +0000)
Change-Id: Iedee023ba95d010aa71886b8946c0562358e4979
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bundles-test/src/main/java/org/opendaylight/odlparent/bundlestest/ServiceReferenceUtil.java
bundles-test/src/main/java/org/opendaylight/odlparent/bundlestest/TestBundleDiag.java
bundles4-test/src/main/java/org/opendaylight/odlparent/bundles4test/ServiceReferenceUtil.java
bundles4-test/src/main/java/org/opendaylight/odlparent/bundles4test/TestBundleDiag.java
features4-test/src/main/java/org/opendaylight/odlparent/featuretest/ReflectionUtil.java

index 03db2a808165d31ffb6ee15dd03d9dec0f0d58d0..f47b557845c0a5e2bb61360a9e2c0db92b73339e 100644 (file)
@@ -48,8 +48,7 @@ public class ServiceReferenceUtil {
         if (usingBundles == null) {
             return Collections.emptyList();
         } else {
-            return Arrays.asList(usingBundles).stream()
-                    .map(bundle -> bundle.getSymbolicName()).collect(Collectors.toList());
+            return Arrays.stream(usingBundles).map(Bundle::getSymbolicName).collect(Collectors.toList());
         }
     }
 
index 2ee3b2689559c1560ec2c6addc5e92e5eaf1d656..56b2f38da34bfef75994ab728267e142f48a8a25 100644 (file)
@@ -59,7 +59,7 @@ public class TestBundleDiag {
                         condition -> LOG.info("checkBundleDiagInfos: Elapsed time {}s, remaining time {}s, {}",
                             condition.getElapsedTimeInMS() / 1000, condition.getRemainingTimeInMS() / 1000,
                             ((BundleDiagInfos) condition.getValue()).getFullDiagnosticText()))
-                    .until(() -> getBundleDiagInfos(), new BundleServiceSummaryMatcher());
+                    .until(this::getBundleDiagInfos, new BundleServiceSummaryMatcher());
 
             // If we're here then either BundleServiceSummaryMatcher quit because of Active, Failure or Stopping..
             BundleDiagInfos bundleInfos = getBundleDiagInfos();
index 767c7ebb51d88c727214a7154accedd7c4b672ed..06d9f0b54a9d0afc208816536ad0ae0635464509 100644 (file)
@@ -48,8 +48,7 @@ public class ServiceReferenceUtil {
         if (usingBundles == null) {
             return Collections.emptyList();
         } else {
-            return Arrays.asList(usingBundles).stream()
-                .map(bundle -> bundle.getSymbolicName()).collect(Collectors.toList());
+            return Arrays.stream(usingBundles).map(Bundle::getSymbolicName).collect(Collectors.toList());
         }
     }
 
index e86e52ad94c768680b16b8dac9cdd2968549fedf..57f11e8ada93284fd2a9032d15fdddc420abfd60 100644 (file)
@@ -74,7 +74,7 @@ public class TestBundleDiag {
                         condition -> LOG.info("checkBundleDiagInfos: Elapsed time {}s, remaining time {}s, {}",
                             condition.getElapsedTimeInMS() / 1000, condition.getRemainingTimeInMS() / 1000,
                             ((BundleDiagInfos) condition.getValue()).getFullDiagnosticText()))
-                    .until(() -> getBundleDiagInfos(), new BundleServiceSummaryMatcher());
+                    .until(this::getBundleDiagInfos, new BundleServiceSummaryMatcher());
 
             // If we're here then either BundleServiceSummaryMatcher quit because of Active, Failure or Stopping..
             BundleDiagInfos bundleInfos = getBundleDiagInfos();
index 4476ec23c764d9fbadee2fd0087196d20917cf3f..c8b13bd184c56f46a1025eac57518afdd2b2c6cb 100644 (file)
@@ -40,9 +40,9 @@ public final class ReflectionUtil {
             ClassPath classPath = ClassPath.from(classLoader);
             // inspired by https://github.com/vorburger/ch.vorburger.minecraft.osgi/blob/master/ch.vorburger.minecraft.osgi/src/main/java/ch/vorburger/osgi/embedded/PackagesBuilder.java
             return classPath.getTopLevelClassesRecursive(packageName)
-                    .stream().map(classInfo -> classInfo.load())
+                    .stream().map(ClassPath.ClassInfo::load)
                      // to include all inner classes, including anonymous inner classes:
-                    .flatMap(clazz -> getDeclaredAndAnonymousInnerClass(clazz));
+                    .flatMap(ReflectionUtil::getDeclaredAndAnonymousInnerClass);
         } catch (IOException e) {
             throw new IllegalStateException("ClassPath.from(classLoader) failed", e);
         }