Class ImmutableSetMultimap.Builder<K,​V>

  • Enclosing class:
    ImmutableSetMultimap<K,​V>

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

    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.

    Since:
    2.0 (imported from Google Collections Library)