WhiteWalker
WhiteWalker

Reputation: 405

Apache Commons MultiMap is deprecated, what should I use now?

Apache Commons' MultiMap interface with its MultiValueMap implementation is deprecated since version 4.1. And MultiHashMap seems to go entirely...

What should I use as an alternative?

Upvotes: 7

Views: 14712

Answers (1)

Ori Marko
Ori Marko

Reputation: 58782

MultiValuedMap is the replacement and it isn't deprecated:

Defines a map that holds a collection of values against each key.

For example:

 MultiValuedMap<K, String> map = new MultiValuedHashMap<K, String>();
 map.put(key, "A");
 map.put(key, "B");
 map.put(key, "C");
 Collection<String> coll = map.get(key);

It replaced MultiHashMap

Class now available as MultiValueMap in map subpackage. This version is due to be removed in collections v4.0.

and MultiValueMap:

Deprecated. since 4.1, use MultiValuedMap instead

The deprecation related to apache commons collections4 dependency jar

I think the third you meant MultiMap was deprecated

Upvotes: 10

Related Questions