Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Refactor datamodel
[nonrtric.git]
/
enrichment-coordinator-service
/
src
/
main
/
java
/
org
/
oransc
/
enrichment
/
repository
/
MultiMap.java
diff --git
a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/MultiMap.java
b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/MultiMap.java
index
c2b8270
..
25e559c
100644
(file)
--- a/
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/MultiMap.java
+++ b/
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/MultiMap.java
@@
-38,14
+38,16
@@
public class MultiMap<T> {
this.map.computeIfAbsent(key, k -> new HashMap<>()).put(id, value);
}
this.map.computeIfAbsent(key, k -> new HashMap<>()).put(id, value);
}
- public
void
remove(String key, String id) {
+ public
T
remove(String key, String id) {
Map<String, T> innerMap = this.map.get(key);
if (innerMap != null) {
Map<String, T> innerMap = this.map.get(key);
if (innerMap != null) {
- innerMap.remove(id);
+
T removedElement =
innerMap.remove(id);
if (innerMap.isEmpty()) {
this.map.remove(key);
}
if (innerMap.isEmpty()) {
this.map.remove(key);
}
+ return removedElement;
}
}
+ return null;
}
public Collection<T> get(String key) {
}
public Collection<T> get(String key) {