mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-16 09:51:38 +02:00
Use filter() to skip undesired instances
Change-Id: Ifc7cc5affe494c8573065cdcf7a018584e553a01
This commit is contained in:
parent
47eedecb8a
commit
aab784e46c
@ -86,8 +86,7 @@ public class PolicyHandler {
|
||||
public List<Policy> getPolicies() {
|
||||
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
|
||||
.filter(policy -> policy instanceof TunnelPolicy)
|
||||
.map(policy -> new TunnelPolicy((TunnelPolicy) policy))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user