List of guava Multimap

571 Views Asked by At

Is to possible to create a list of guava Multimap?

I created a regular Multimap as so, but was not able to create as list of Multimaps

Multimap<String, Integer> map = ArrayListMultimap.create();
1

There are 1 best solutions below

1
On BEST ANSWER

You already have initialized the MultiMap precisely using:

Multimap<String, Integer> map = ArrayListMultimap.create();

Now if you tend to implement a java.util.List of such a MultiMap, you can simply initialise it as:

java.util.List<MultiMap<String, Integer>> listOfMap = new ArrayList<>(); 
// array list initialisation within which the multimap can be initialised using previous code

listOfMap.add(map);