Class ImmutableListMultimap.Builder<K,​V>

  • Enclosing class:

    public static final class ImmutableListMultimap.Builder<K,​V>
    extends ImmutableMultimap.Builder<K,​V>
    A builder for creating immutable ListMultimap instances, especially public static final multimaps ("constant multimaps"). Example:
       static final Multimap<String, Integer> STRING_TO_INTEGER_MULTIMAP =
           new ImmutableListMultimap.Builder<String, Integer>()
               .put("one", 1)
               .putAll("several", 1, 2, 3)
               .putAll("many", 1, 2, 3, 4, 5)

    Builder instances can be reused; it is safe to call build() multiple times to build multiple multimaps in series. Each multimap contains the key-value mappings in the previously created multimaps.

    2.0 (imported from Google Collections Library)