X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dmaap-adaptor-java%2Fsrc%2Fmain%2Fjava%2Forg%2Foran%2Fdmaapadapter%2Frepository%2FMultiMap.java;fp=dmaap-adaptor-java%2Fsrc%2Fmain%2Fjava%2Forg%2Foran%2Fdmaapadapter%2Frepository%2FMultiMap.java;h=0000000000000000000000000000000000000000;hb=248487e4d6f6417da3d0f6784e20e81bcb4330d7;hp=f7cc14e92082977485c310629e83acef853c3831;hpb=844931b62f35ce6ee2d9dc7274573fc54e14407a;p=nonrtric.git diff --git a/dmaap-adaptor-java/src/main/java/org/oran/dmaapadapter/repository/MultiMap.java b/dmaap-adaptor-java/src/main/java/org/oran/dmaapadapter/repository/MultiMap.java deleted file mode 100644 index f7cc14e9..00000000 --- a/dmaap-adaptor-java/src/main/java/org/oran/dmaapadapter/repository/MultiMap.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019-2021 Nordix Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================LICENSE_END=================================== - */ - -package org.oran.dmaapadapter.repository; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.Vector; - -/** - * 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<>(); - - public void put(String key, String id, T value) { - this.map.computeIfAbsent(key, k -> new HashMap<>()).put(id, value); - } - - public T remove(String key, String id) { - Map innerMap = this.map.get(key); - if (innerMap != null) { - T removedElement = innerMap.remove(id); - if (innerMap.isEmpty()) { - this.map.remove(key); - } - return removedElement; - } - return null; - } - - public T get(String key1, String key2) { - Map innerMap = this.map.get(key1); - if (innerMap == null) { - return null; - } - return innerMap.get(key2); - } - - public Collection get(String key) { - Map innerMap = this.map.get(key); - if (innerMap == null) { - return Collections.emptyList(); - } - return new Vector<>(innerMap.values()); - } - - public Set keySet() { - return this.map.keySet(); - } - - public void clear() { - this.map.clear(); - } - -}