Search code examples
javaguavamultimap

Guava Multimap. Put value both to the end and beginning


I use Guava Multimap:

Multimap<Integer, String> commandMap = LinkedHashMultimap.create();
...
actionMap.put(index, "string"); // Put value at the end of list.

This command put value at the end of list. But I need to be able to add both to the end and beginning. Is there a way to solve this?


Solution

  • This isn't a ListMultimap, it's a SetMultimap. If you want a ListMultimap, use ArrayListMultimap or LinkedListMultimap.