polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [2/2] zest-java git commit: Replacing anonymous classes with Java 8 lambdas.
Date Sat, 07 Nov 2015 12:22:35 GMT
Replacing anonymous classes with Java 8 lambdas.


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/22df34af
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/22df34af
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/22df34af

Branch: refs/heads/develop
Commit: 22df34af4096b53f919a80e66945a349cda3be9f
Parents: 1a1bc37
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Sat Nov 7 20:22:15 2015 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Sat Nov 7 20:22:15 2015 +0800

----------------------------------------------------------------------
 .../library/rest/common/link/LinksUtil.java     | 47 +++-----------------
 1 file changed, 7 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/22df34af/libraries/rest-common/src/main/java/org/apache/zest/library/rest/common/link/LinksUtil.java
----------------------------------------------------------------------
diff --git a/libraries/rest-common/src/main/java/org/apache/zest/library/rest/common/link/LinksUtil.java
b/libraries/rest-common/src/main/java/org/apache/zest/library/rest/common/link/LinksUtil.java
index 772642a..272a621 100644
--- a/libraries/rest-common/src/main/java/org/apache/zest/library/rest/common/link/LinksUtil.java
+++ b/libraries/rest-common/src/main/java/org/apache/zest/library/rest/common/link/LinksUtil.java
@@ -28,50 +28,24 @@ public final class LinksUtil
 {
    public static Predicate<Link> withId(final String id)
    {
-      return new Predicate<Link>()
-      {
-         @Override
-         public boolean test(Link link )
-         {
-            return link.id().get().equals(id);
-         }
-      };
+      return link -> link.id().get().equals( id);
    }
 
    public static Predicate<Link> withText(final String text)
    {
-      return new Predicate<Link>()
-      {
-         @Override
-         public boolean test(Link link )
-         {
-            return link.text().get().equals(text);
-         }
-      };
+      return link -> link.text().get().equals( text);
    }
 
    public static Predicate<Link> withRel(final String rel)
    {
-      return new Predicate<Link>()
-      {
-         @Override
-         public boolean test(Link link )
-         {
-            return link.rel().get().equals(rel);
-         }
-      };
+      return link -> link.rel().get().equals( rel);
    }
 
    public static Predicate<Link> withClass(final String clazz)
    {
-      return new Predicate<Link>()
-      {
-         @Override
-         public boolean test(Link link )
-         {
-             String classes = link.classes().get();
-             return classes != null && classes.contains( clazz );
-         }
+      return link -> {
+          String classes = link.classes().get();
+          return classes != null && classes.contains( clazz );
       };
    }
 
@@ -87,13 +61,6 @@ public final class LinksUtil
 
    public static Function<Link, String> toRel()
    {
-      return new Function<Link, String>()
-      {
-         @Override
-         public String apply(Link link )
-         {
-            return link.rel().get();
-         }
-      };
+      return link -> link.rel().get();
    }
 }


Mime
View raw message