Committed by
Gerrit Code Review
Simplify method by removing transient use of Map.Entry
Change-Id: I045c4e55cf8470f3a89d0f95dae67d1020dde86a
Showing
1 changed file
with
5 additions
and
5 deletions
... | @@ -17,7 +17,6 @@ package org.onosproject.store.resource.impl; | ... | @@ -17,7 +17,6 @@ package org.onosproject.store.resource.impl; |
17 | 17 | ||
18 | import com.google.common.collect.ImmutableList; | 18 | import com.google.common.collect.ImmutableList; |
19 | import com.google.common.collect.ImmutableSet; | 19 | import com.google.common.collect.ImmutableSet; |
20 | -import com.google.common.collect.Maps; | ||
21 | import org.onlab.util.GuavaCollectors; | 20 | import org.onlab.util.GuavaCollectors; |
22 | import org.onlab.util.Tools; | 21 | import org.onlab.util.Tools; |
23 | import org.onosproject.net.resource.ContinuousResource; | 22 | import org.onosproject.net.resource.ContinuousResource; |
... | @@ -135,9 +134,10 @@ class ConsistentContinuousResourceStore { | ... | @@ -135,9 +134,10 @@ class ConsistentContinuousResourceStore { |
135 | 134 | ||
136 | Stream<ContinuousResource> getResources(ResourceConsumer consumer) { | 135 | Stream<ContinuousResource> getResources(ResourceConsumer consumer) { |
137 | return consumers.values().stream() | 136 | return consumers.values().stream() |
138 | - .flatMap(x -> x.value().allocations().stream() | 137 | + .flatMap(x -> x.value().allocations().stream()) |
139 | - .map(y -> Maps.immutableEntry(x.value().original(), y))) | 138 | + .filter(x -> x.consumer().equals(consumer)) |
140 | - .filter(x -> x.getValue().consumer().equals(consumer)) | 139 | + // this cast is safe because this class stores |
141 | - .map(x -> (ContinuousResource) (x.getValue().resource())); | 140 | + // continuous resource allocations only |
141 | + .map(x -> (ContinuousResource) x.resource()); | ||
142 | } | 142 | } |
143 | } | 143 | } | ... | ... |
-
Please register or login to post a comment