Search code examples
javamultimap

How to store ListMultimap values in individual arraylists


/* Sample code*/

ListMultimap<String, String> m =ArrayListMultimap.create();

for (String test:m.keySet())
   {
     BaseTest.getLogger().info("Mapped elements:"+ test +"-->"+ m.get(test) );

    }

I want to store m.get(test) values in three individual arraylists or array of arraylist, so that i can access them using list.get(1) like..this...any suggestions??


Solution

  • Collection<List<String>> collectionOfLists = Multimaps.asMap(m).values();
    

    Done. Now all the lists are in the collectionOfLists collection.