1 /*
2 * Copyright 2002-2012 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.foxinmy.weixin4j.util;
18
19 import java.util.List;
20 import java.util.Map;
21
22 /**
23 * Extension of the {@code Map} interface that stores multiple values.
24 *
25 * @author Arjen Poutsma
26 * @since 3.0
27 */
28 public interface MultiValueMap<K, V> extends Map<K, List<V>> {
29
30 /**
31 * Return the first value for the given key.
32 *
33 * @param key
34 * the key
35 * @return the first value for the specified key, or {@code null}
36 */
37 V getFirst(K key);
38
39 /**
40 * Add the given single value to the current list of values for the given
41 * key.
42 *
43 * @param key
44 * the key
45 * @param value
46 * the value to be added
47 */
48 void add(K key, V value);
49
50 /**
51 * Set the given single value under the given key.
52 *
53 * @param key
54 * the key
55 * @param value
56 * the value to set
57 */
58 void set(K key, V value);
59
60 /**
61 * Set the given values under.
62 *
63 * @param values
64 * the values.
65 */
66 void setAll(Map<K, V> values);
67
68 /**
69 * Returns the first values contained in this {@code MultiValueMap}.
70 *
71 * @return a single value representation of this map
72 */
73 Map<K, V> toSingleValueMap();
74
75 }