2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.vid.utils;
23 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
25 import java.util.Collection;
26 import java.util.function.Function;
28 import static java.util.stream.Collectors.toSet;
30 @JsonPropertyOrder({"keyType", "valuesType"})
31 public class Multival<K, V> {
32 private final String keyType;
33 private final String valuesType;
35 private final Collection<V> values;
37 private Multival(String keyType, K key, String valuesType, Collection<V> values) {
38 this.keyType = keyType;
40 this.valuesType = valuesType;
44 public static <K, V> Multival<K, V> of(String keyType, K key, String valuesType, Collection<V> values) {
45 return new Multival<>(keyType, key, valuesType, values);
48 public String getKeyType() {
52 public String getValuesType() {
60 public Collection<V> getValues() {
64 public <W> Multival<K, W> mapEachVal(Function<V, W> mapper) {
69 this.getValues().stream()