-
- Type Parameters:
K
- the type of keys maintained by this mapV
- the type of mapped values
- All Known Implementing Classes:
- AbstractMultivaluedMap, MultivaluedHashMap
public interface MultivaluedMap<K,V> extends Map<K,List<V>>
A map of key-values pairs. Each key can have zero or more values.- Since:
- 1.0
- Author:
- Paul Sandoz, Marc Hadley, Marek Potociar
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description void
add(K key, V value)
Add a value to the current list of values for the supplied key.void
addAll(K key, List<V> valueList)
Add all the values from the supplied value list to the current list of values for the supplied key.void
addAll(K key, V... newValues)
Add multiple values to the current list of values for the supplied key.void
addFirst(K key, V value)
Add a value to the first position in the current list of values for the supplied key.boolean
equalsIgnoreValueOrder(MultivaluedMap<K,V> otherMap)
Compare the specified map with this map for equality modulo the order of values for each key.V
getFirst(K key)
A shortcut to get the first value of the supplied key.void
putSingle(K key, V value)
Set the key's value to be a one item list consisting of the supplied value.-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Method Detail
-
putSingle
void putSingle(K key, V value)
Set the key's value to be a one item list consisting of the supplied value. Any existing values will be replaced.- Parameters:
key
- the keyvalue
- the single value of the key
-
add
void add(K key, V value)
Add a value to the current list of values for the supplied key.- Parameters:
key
- the keyvalue
- the value to be added.
-
getFirst
V getFirst(K key)
A shortcut to get the first value of the supplied key.- Parameters:
key
- the key- Returns:
- the first value for the specified key or null if the key is not in the map.
-
addAll
void addAll(K key, V... newValues)
Add multiple values to the current list of values for the supplied key. If the supplied array of new values is empty, method returns immediately. Method throws aNullPointerException
if the supplied array of values isnull
.- Parameters:
key
- the key.newValues
- the values to be added.- Throws:
NullPointerException
- if the supplied array of new values isnull
.- Since:
- 2.0
-
addAll
void addAll(K key, List<V> valueList)
Add all the values from the supplied value list to the current list of values for the supplied key. If the supplied value list is empty, method returns immediately. Method throws aNullPointerException
if the supplied array of values isnull
.- Parameters:
key
- the key.valueList
- the list of values to be added.- Throws:
NullPointerException
- if the supplied value list isnull
.- Since:
- 2.0
-
addFirst
void addFirst(K key, V value)
Add a value to the first position in the current list of values for the supplied key.- Parameters:
key
- the keyvalue
- the value to be added.- Since:
- 2.0
-
equalsIgnoreValueOrder
boolean equalsIgnoreValueOrder(MultivaluedMap<K,V> otherMap)
Compare the specified map with this map for equality modulo the order of values for each key. Specifically, the values associated with each key are compared as if they were ordered lists.- Parameters:
otherMap
- map to be compared to this one.- Returns:
- true if the maps are equal modulo value ordering.
- Since:
- 2.0
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/ws/rs/core/multivaluedmap.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.