public interface MultiMap<K,V>
StandardMultiMap| 限定符和类型 | 方法和说明 |
|---|---|
static <K,V> MultiMap<K,V> |
arrayListMultimap()
|
Map<K,Collection<V>> |
asMap()
Get java map of the multimap, the returned map is modifiable.
|
void |
clear()
Clear the map and remove all key-value pairs.
|
boolean |
containsKey(Object o)
Whether the map contains the specified key.
|
static <K,V> MultiMap<K,V> |
emptyMultiMap()
Get a new empty
MultiMap instance. |
Collection<Map.Entry<K,V>> |
entries()
Get all key-value pairs in the map.
|
boolean |
equals(Object o)
Whether the map is equal to the specified object.
|
default void |
forEach(BiConsumer<? super K,? super V> action)
Traverse all key-value pairs in the map.
|
Collection<V> |
get(K k)
Get all values of the specified key, if the key does not exist, return an empty collection.
|
int |
hashCode()
Get the hash code of the map.
|
boolean |
isEmpty()
Whether the map is empty.
|
Set<K> |
keySet()
Get all keys in the map.
|
static <K,V> MultiMap<K,V> |
linkedHashMultimap()
Create a new
MultiMap instance with LinkedHashMap
as the underlying map and LinkedHashSet as the collection. |
static <K,V> MultiMap<K,V> |
linkedListMultimap()
Create a new
MultiMap instance with LinkedHashMap
as the underlying map and ArrayList as the collection. |
boolean |
put(K k,
V v)
Put the specified key-value pair into the map.
|
void |
putAll(K k,
Iterable<? extends V> iterable)
Put all key-value pairs in the specified map into the map.
|
void |
putAll(MultiMap<K,V> multiMap)
Put all key-value pairs in the specified map into the map.
|
Collection<V> |
removeAll(Object o)
Remove all key-value pairs with the specified key from the map.
|
int |
size()
Get the total number of key-value pairs in the map.
|
Collection<V> |
values()
Get all values in the map.
|
static <K,V> MultiMap<K,V> arrayListMultimap()
static <K,V> MultiMap<K,V> linkedListMultimap()
MultiMap instance with LinkedHashMap
as the underlying map and ArrayList as the collection.MultiMap instanceLinkedHashMap,
ArrayListstatic <K,V> MultiMap<K,V> linkedHashMultimap()
MultiMap instance with LinkedHashMap
as the underlying map and LinkedHashSet as the collection.MultiMap instanceLinkedHashMap,
LinkedHashSetstatic <K,V> MultiMap<K,V> emptyMultiMap()
MultiMap instance.MultiMap instanceint size()
boolean isEmpty()
boolean containsKey(Object o)
o - keyboolean put(K k, V v)
k - keyv - valuevoid putAll(K k, Iterable<? extends V> iterable)
k - keyiterable - valuesvoid putAll(MultiMap<K,V> multiMap)
multiMap - mapCollection<V> removeAll(Object o)
o - keyvoid clear()
Collection<V> get(K k)
k - keyCollection<V> values()
Collection<Map.Entry<K,V>> entries()
Get all key-value pairs in the map.
The returned entries are modifiable, but the modification will not affect the map.
default void forEach(BiConsumer<? super K,? super V> action)
action - actionMap<K,Collection<V>> asMap()
boolean equals(Object o)
Copyright © 2024. All rights reserved.