Use lambda expression to simplify statements

Change-Id: Ib8ddac6e93327ade9d42984d8eba66be7047d051
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index c60325a..05a20f9 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -51,7 +51,6 @@
 import org.onosproject.net.resource.link.LinkResourceService;
 import org.onosproject.net.topology.LinkWeight;
 import org.onosproject.net.topology.Topology;
-import org.onosproject.net.topology.TopologyEdge;
 import org.onosproject.net.topology.TopologyService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -265,34 +264,31 @@
     private Set<Path> getOpticalPaths(OpticalConnectivityIntent intent) {
         // Route in WDM topology
         Topology topology = topologyService.currentTopology();
-        LinkWeight weight = new LinkWeight() {
-            @Override
-            public double weight(TopologyEdge edge) {
-                // Disregard inactive or non-optical links
-                if (edge.link().state() == Link.State.INACTIVE) {
-                    return -1;
-                }
-                if (edge.link().type() != Link.Type.OPTICAL) {
-                    return -1;
-                }
-                // Adhere to static port mappings
-                DeviceId srcDeviceId = edge.link().src().deviceId();
-                if (srcDeviceId.equals(intent.getSrc().deviceId())) {
-                    ConnectPoint srcStaticPort = staticPort(intent.getSrc());
-                    if (srcStaticPort != null) {
-                        return srcStaticPort.equals(edge.link().src()) ? 1 : -1;
-                    }
-                }
-                DeviceId dstDeviceId = edge.link().dst().deviceId();
-                if (dstDeviceId.equals(intent.getDst().deviceId())) {
-                    ConnectPoint dstStaticPort = staticPort(intent.getDst());
-                    if (dstStaticPort != null) {
-                        return dstStaticPort.equals(edge.link().dst()) ? 1 : -1;
-                    }
-                }
-
-                return 1;
+        LinkWeight weight = edge -> {
+            // Disregard inactive or non-optical links
+            if (edge.link().state() == Link.State.INACTIVE) {
+                return -1;
             }
+            if (edge.link().type() != Link.Type.OPTICAL) {
+                return -1;
+            }
+            // Adhere to static port mappings
+            DeviceId srcDeviceId = edge.link().src().deviceId();
+            if (srcDeviceId.equals(intent.getSrc().deviceId())) {
+                ConnectPoint srcStaticPort = staticPort(intent.getSrc());
+                if (srcStaticPort != null) {
+                    return srcStaticPort.equals(edge.link().src()) ? 1 : -1;
+                }
+            }
+            DeviceId dstDeviceId = edge.link().dst().deviceId();
+            if (dstDeviceId.equals(intent.getDst().deviceId())) {
+                ConnectPoint dstStaticPort = staticPort(intent.getDst());
+                if (dstStaticPort != null) {
+                    return dstStaticPort.equals(edge.link().dst()) ? 1 : -1;
+                }
+            }
+
+            return 1;
         };
 
         ConnectPoint start = intent.getSrc();
diff --git a/core/net/src/main/java/org/onosproject/net/link/impl/LinkManager.java b/core/net/src/main/java/org/onosproject/net/link/impl/LinkManager.java
index 7bdeb4f..d6f72fd 100644
--- a/core/net/src/main/java/org/onosproject/net/link/impl/LinkManager.java
+++ b/core/net/src/main/java/org/onosproject/net/link/impl/LinkManager.java
@@ -15,7 +15,6 @@
  */
 package org.onosproject.net.link.impl;
 
-import com.google.common.base.Predicate;
 import com.google.common.collect.FluentIterable;
 import com.google.common.collect.Sets;
 
@@ -126,13 +125,7 @@
     public Iterable<Link> getActiveLinks() {
         checkPermission(LINK_READ);
         return FluentIterable.from(getLinks())
-                .filter(new Predicate<Link>() {
-
-                    @Override
-                    public boolean apply(Link input) {
-                        return input.state() == State.ACTIVE;
-                    }
-                });
+                .filter(input -> input.state() == State.ACTIVE);
     }
 
     @Override
diff --git a/core/net/src/main/java/org/onosproject/net/statistic/impl/StatisticManager.java b/core/net/src/main/java/org/onosproject/net/statistic/impl/StatisticManager.java
index 996ad14e..57964d6 100644
--- a/core/net/src/main/java/org/onosproject/net/statistic/impl/StatisticManager.java
+++ b/core/net/src/main/java/org/onosproject/net/statistic/impl/StatisticManager.java
@@ -348,12 +348,7 @@
      * @return predicate
      */
     private static Predicate<FlowEntry> hasApplicationId(ApplicationId appId) {
-        return new Predicate<FlowEntry>() {
-            @Override
-            public boolean apply(FlowEntry flowEntry) {
-                return flowEntry.appId() == appId.id();
-            }
-        };
+        return flowEntry -> flowEntry.appId() == appId.id();
     }
 
     /**
@@ -364,16 +359,13 @@
      * @return predicate
      */
     private static Predicate<FlowEntry> hasGroupId(Optional<GroupId> groupId) {
-        return new Predicate<FlowEntry>() {
-            @Override
-            public boolean apply(FlowEntry flowEntry) {
-                if (!groupId.isPresent()) {
-                    return false;
-                }
-                // FIXME: The left hand type and right hand type don't match
-                // FlowEntry.groupId() still returns a short value, not int.
-                return flowEntry.groupId().equals(groupId.get());
+        return flowEntry -> {
+            if (!groupId.isPresent()) {
+                return false;
             }
+            // FIXME: The left hand type and right hand type don't match
+            // FlowEntry.groupId() still returns a short value, not int.
+            return flowEntry.groupId().equals(groupId.get());
         };
     }
 }