The interface does not belong to Java, which means that the interface is not part of the core libraries. It is part of the javax.ws.rs hierarchy, which is part of the JAX-RS specification. It is used by entities implementing the specification, such as Jersey . It is used when cards must refer not only to one value, but also to any number of values. An example of a use could be, for example, storing a request header in which you can add several values for each key. Or even no keys in some cases where it is easier to process an empty list compared to null .
Take this HTTP header, for example:
Accept-Encoding: compress; q = 0.5, gzip; q = 1.0
Would you simulate this with
MultivaluedMap<String, String> map = ... map.add("Accept-Encoding", "compress;q=0.5"); map.add("Accept-Encoding", "gzip;q=1.0");
internally in jersey. This type of multi-value storage is a common problem in Java that other map developers, such as Guava , are accessing .
This is basically what javadoc says:
Map of key-value pairs. Each key may have zero or more values.
Rafael winterhalter
source share