X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=enrichment-coordinator-service%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fenrichment%2Frepository%2FMultiMap.java;h=25e559ceefa0dcf560c617f15bab8659ffd18d5b;hb=c760c62129b21c31243a331cf3c8f1963a1058a3;hp=e64ea223f1437c39eba16aaf36e29f808ec64733;hpb=ebf3211ddd6e634ca9c0a2fec56abd1f12c7625d;p=nonrtric.git 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 e64ea223..25e559ce 100644 --- 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 @@ -27,9 +27,9 @@ import java.util.Map; import java.util.Vector; /** - * Dynamic representation of all Rics in the system. + * A map, where each key can be bound to may values (where each value has an own + * ID) */ - public class MultiMap { private final Map> map = new HashMap<>(); @@ -38,14 +38,16 @@ public class MultiMap { 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 innerMap = this.map.get(key); if (innerMap != null) { - innerMap.remove(id); + T removedElement = innerMap.remove(id); if (innerMap.isEmpty()) { this.map.remove(key); } + return removedElement; } + return null; } public Collection get(String key) {