You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2016/04/20 17:49:19 UTC

camel git commit: Camel CDI: use Comparator.comparing and method references instead of lambda expressions

Repository: camel
Updated Branches:
  refs/heads/master 01b411892 -> e06e2af36


Camel CDI: use Comparator.comparing and method references instead of lambda expressions


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e06e2af3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e06e2af3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e06e2af3

Branch: refs/heads/master
Commit: e06e2af36599679b72742106bf8af0fad57a4dee
Parents: 01b4118
Author: Antonin Stefanutti <an...@stefanutti.fr>
Authored: Wed Apr 20 17:49:08 2016 +0200
Committer: Antonin Stefanutti <an...@stefanutti.fr>
Committed: Wed Apr 20 17:49:08 2016 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/cdi/CdiSpiHelper.java        | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e06e2af3/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiSpiHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiSpiHelper.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiSpiHelper.java
index 33530b7..18290b3 100644
--- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiSpiHelper.java
+++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiSpiHelper.java
@@ -34,6 +34,7 @@ import java.util.function.Predicate;
 import java.util.stream.Stream;
 
 import static java.security.AccessController.doPrivileged;
+import static java.util.Comparator.comparing;
 import static java.util.Objects.requireNonNull;
 import static java.util.stream.Collectors.collectingAndThen;
 import static java.util.stream.Collectors.joining;
@@ -148,7 +149,7 @@ final class CdiSpiHelper {
      */
     private static String createTypeCollectionId(Collection<? extends Type> types) {
         return types.stream()
-            .sorted((t1, t2) -> createTypeId(t1).compareTo(createTypeId(t2)))
+            .sorted(comparing(CdiSpiHelper::createTypeId))
             .map(CdiSpiHelper::createTypeId)
             .collect(joining(",", "[", "]"));
     }
@@ -201,7 +202,7 @@ final class CdiSpiHelper {
             (PrivilegedAction<Method[]>) () -> annotation.annotationType().getDeclaredMethods());
 
         return Stream.of(methods)
-            .sorted((m1, m2) -> m1.getName().compareTo(m2.getName()))
+            .sorted(comparing(Method::getName))
             .collect(() -> new StringJoiner(",", "@(", ")"),
                 (joiner, method) -> {
                     try {