commit | eca9f3550af36b76698cd2846a527a049533b006 | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Mon Oct 05 15:55:24 2015 -0700 |
committer | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Tue Oct 06 10:31:52 2015 -0700 |
tree | 8b025cbcae443905e29654162357faa1dd581670 | |
parent | 04ae54a5ff5f9e8387827e4ad2d0e941fb9c1059 [diff] |
Don't create an empty set by using Stream API Change-Id: I835cbf6f4926c3391e901597b6d8d203f28a3f41
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java index b30604a..a887490 100644 --- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java +++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java
@@ -209,9 +209,9 @@ tx.begin(); try { Map<ResourceType, Set<ResourceAllocation>> freeResources = getFreeResourcesEx(tx, link); - Set<ResourceAllocation> allFree = new HashSet<>(); - freeResources.values().forEach(allFree::addAll); - return allFree; + return freeResources.values().stream() + .flatMap(Collection::stream) + .collect(Collectors.toSet()); } finally { tx.abort(); }