Apply more functional style

This commit keeps the original behavior, but it may cause a cast error.
It is better to use filter() to avoid the cast error.

Change-Id: Ieb3150e9775ed0689b3861de5179ff1346d2a3e6
diff --git a/src/main/java/org/onosproject/segmentrouting/PolicyHandler.java b/src/main/java/org/onosproject/segmentrouting/PolicyHandler.java
index e773e10..745c64f 100644
--- a/src/main/java/org/onosproject/segmentrouting/PolicyHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/PolicyHandler.java
@@ -30,8 +30,8 @@
 import org.onosproject.store.service.EventuallyConsistentMap;
 import org.slf4j.Logger;
 
-import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import static org.slf4j.LoggerFactory.getLogger;
 
@@ -84,11 +84,12 @@
      * @return policy list
      */
     public List<Policy> getPolicies() {
-        List<Policy> policies = new ArrayList<>();
-        policyStore.values().forEach(policy -> policies.add(
-                new TunnelPolicy((TunnelPolicy) policy)));
-
-        return policies;
+        return policyStore.values()
+                .stream()
+                // keep the original behavior, but it may cause a cast error
+                // it is better to use filter() to omit instances not being TunnelPolicy
+                .map(policy -> new TunnelPolicy((TunnelPolicy) policy))
+                .collect(Collectors.toList());
     }
 
     /**