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());
         };
     }
 }
diff --git a/core/net/src/test/java/org/onosproject/net/device/impl/BasicDeviceOperatorTest.java b/core/net/src/test/java/org/onosproject/net/device/impl/BasicDeviceOperatorTest.java
index 8827c55..2be0df7 100644
--- a/core/net/src/test/java/org/onosproject/net/device/impl/BasicDeviceOperatorTest.java
+++ b/core/net/src/test/java/org/onosproject/net/device/impl/BasicDeviceOperatorTest.java
@@ -24,7 +24,6 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.onlab.packet.ChassisId;
-import org.onosproject.net.config.Config;
 import org.onosproject.net.config.ConfigApplyDelegate;
 import org.onosproject.net.config.basics.BasicDeviceConfig;
 import org.onosproject.net.AnnotationKeys;
@@ -55,11 +54,7 @@
     private static final DeviceDescription DEV1 = new DefaultDeviceDescription(
             DURI, SWITCH, MFR, HW, SW, SN, CID, SA);
 
-    private final ConfigApplyDelegate delegate = new ConfigApplyDelegate() {
-        @Override
-        public void onApply(Config config) {
-        }
-    };
+    private final ConfigApplyDelegate delegate = config -> { };
     private final ObjectMapper mapper = new ObjectMapper();
 
     private static final BasicDeviceConfig SW_BDC = new BasicDeviceConfig();
diff --git a/core/net/src/test/java/org/onosproject/net/host/impl/BasicHostOperatorTest.java b/core/net/src/test/java/org/onosproject/net/host/impl/BasicHostOperatorTest.java
index e7f14b5..940ed91 100644
--- a/core/net/src/test/java/org/onosproject/net/host/impl/BasicHostOperatorTest.java
+++ b/core/net/src/test/java/org/onosproject/net/host/impl/BasicHostOperatorTest.java
@@ -22,7 +22,6 @@
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
-import org.onosproject.net.config.Config;
 import org.onosproject.net.config.ConfigApplyDelegate;
 import org.onosproject.net.config.basics.BasicHostConfig;
 import org.onosproject.net.AnnotationKeys;
@@ -49,11 +48,7 @@
     );
     private static final HostDescription HOST = new DefaultHostDescription(MAC, VLAN, LOC, IP);
 
-    private final ConfigApplyDelegate delegate = new ConfigApplyDelegate() {
-        @Override
-        public void onApply(Config config) {
-        }
-    };
+    private final ConfigApplyDelegate delegate = config -> { };
     private final ObjectMapper mapper = new ObjectMapper();
 
     private static final BasicHostConfig BHC = new BasicHostConfig();
diff --git a/core/net/src/test/java/org/onosproject/net/link/impl/BasicLinkOperatorTest.java b/core/net/src/test/java/org/onosproject/net/link/impl/BasicLinkOperatorTest.java
index fe9e37c..eadbb5c 100644
--- a/core/net/src/test/java/org/onosproject/net/link/impl/BasicLinkOperatorTest.java
+++ b/core/net/src/test/java/org/onosproject/net/link/impl/BasicLinkOperatorTest.java
@@ -22,7 +22,6 @@
 import java.time.Duration;
 import org.junit.Before;
 import org.junit.Test;
-import org.onosproject.net.config.Config;
 import org.onosproject.net.config.ConfigApplyDelegate;
 import org.onosproject.net.config.basics.BasicLinkConfig;
 import org.onosproject.net.AnnotationKeys;
@@ -53,11 +52,7 @@
     private static final SparseAnnotations SA = DefaultAnnotations.builder()
             .set(AnnotationKeys.DURABLE, "true").build();
     private static final LinkDescription LD = new DefaultLinkDescription(SRC, DST, Link.Type.DIRECT, SA);
-    private final ConfigApplyDelegate delegate = new ConfigApplyDelegate() {
-        @Override
-        public void onApply(Config config) {
-        }
-    };
+    private final ConfigApplyDelegate delegate = config -> { };
     private final ObjectMapper mapper = new ObjectMapper();
 
     private static final BasicLinkConfig BLC = new BasicLinkConfig();