Guava ImmutableListMultimap.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 ImmutableListMultimap.Builder class.

This code example shows how to use the following methods:build, orderKeysBy, orderValuesBy, put
    assertEquals(Arrays.asList(1), builder.build().get("one"));
  } 
 
  public void testBuilderPutAllIterable() { 
    ImmutableListMultimap.Builder<String, Integer> builder
        = ImmutableListMultimap.builder();
    builder.putAll("foo", Arrays.asList(1, 2, 3));
    builder.putAll("bar", Arrays.asList(4, 5));
    builder.putAll("foo", Arrays.asList(6, 7));
    Multimap<String, Integer> multimap = builder.build();
    assertEquals(Arrays.asList(1, 2, 3, 6, 7), multimap.get("foo"));
    assertEquals(Arrays.asList(4, 5), multimap.get("bar"));
    assertEquals(7, multimap.size());
  } 
 
  public void testBuilderPutAllVarargs() { 
    ImmutableListMultimap.Builder<String, Integer> builder
        = ImmutableListMultimap.builder();
    builder.putAll("foo", 1, 2, 3);
    builder.putAll("bar", 4, 5);

4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Guava ImmutableListMultimap.Builder Methods: