Guava Multimap Guide

Multimap is one Map implementation from Google Guava library, maps keys to values, similar to Map, but in which each key may be associated with multiple values. You can visualize the contents of a multimap either as a map from keys to nonempty collections of values[1]:

  • a → 1, 2
  • b → 3

Maven Dependency

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>31.0.1-jre</version>
</dependency>

ArrayListMultimap

SetMultimap

References


  1. Guava Multimap ↩︎