Avoid down cast
Change-Id: I8e85ca3ac5df8b14f52f4c4e0606bd570853d92a
diff --git a/core/net/src/main/java/org/onosproject/net/resource/impl/LinkResourceManager.java b/core/net/src/main/java/org/onosproject/net/resource/impl/LinkResourceManager.java
index 209e62c..e48b2cb 100644
--- a/core/net/src/main/java/org/onosproject/net/resource/impl/LinkResourceManager.java
+++ b/core/net/src/main/java/org/onosproject/net/resource/impl/LinkResourceManager.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.net.resource.impl;
+import com.google.common.collect.Sets;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -284,9 +285,8 @@
LinkResourceAllocations allocations) {
checkPermission(Permission.LINK_READ);
- Set<ResourceRequest> result = new HashSet<>();
Set<ResourceAllocation> allocatedRes = allocations.getResourceAllocation(link);
- result = (Set<ResourceRequest>) getAvailableResources(link);
+ Set<ResourceRequest> result = Sets.newHashSet(getAvailableResources(link));
result.addAll(allocatedRes);
return result;
}