Guava ImmutableSetMultimap.Builder - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava ImmutableSetMultimap.Builder class.

This code example shows how to use the following methods:build, put, putAll
    assertEquals(ImmutableSet.of(1, 2, 3, 6, 7), multimap.get("foo"));
    assertEquals(ImmutableSet.of(4, 5), multimap.get("bar"));
    assertEquals(7, multimap.size());
  } 
 
  public void testBuilderPutAllWithDuplicates() { 
    ImmutableSetMultimap.Builder<String, Integer> builder
        = ImmutableSetMultimap.builder();
    builder.putAll("foo", 1, 2, 3);
    builder.putAll("bar", 4, 5);
    builder.putAll("foo", 1, 6, 7);
    ImmutableSetMultimap<String, Integer> multimap = builder.build();
    assertEquals(7, multimap.size());
  } 
 
  public void testBuilderPutWithDuplicates() { 
    ImmutableSetMultimap.Builder<String, Integer> builder
        = ImmutableSetMultimap.builder();
    builder.putAll("foo", 1, 2, 3);
    builder.putAll("bar", 4, 5);

5
CodeRank
See Code Examples for Guava ImmutableSetMultimap.Builder Methods: