@Test void shouldStripEntriesWithEmptyList() { assertThat(GuavaUtils.toMultimap(ImmutableMap .<String, List<String>>builder() .put("k1", ImmutableList.of()) .build()) .asMap()) .isEqualTo(ImmutableListMultimap.of().asMap()); }
public static <K, V> ImmutableListMultimap<K, V> toMultimap(Map<K, List<V>> rights) { return rights.entrySet() .stream() .flatMap(e -> e.getValue().stream().map(right -> Pair.of(e.getKey(), right))) .collect(Guavate.toImmutableListMultimap(Pair::getKey, Pair::getValue)); }
GuavaUtils { public static <K, V> ImmutableListMultimap<K, V> toMultimap(Map<K, List<V>> rights) { return rights.entrySet() .stream() .flatMap(e -> e.getValue().stream().map(right -> Pair.of(e.getKey(), right))) .collect(Guavate.toImmutableListMultimap(Pair::getKey, Pair::getValue)); } }
GuavaUtils { public static <K, V> ImmutableListMultimap<K, V> toMultimap(Map<K, List<V>> rights) { return rights.entrySet() .stream() .flatMap(e -> e.getValue().stream().map(right -> Pair.of(e.getKey(), right))) .collect(Guavate.toImmutableListMultimap(Pair::getKey, Pair::getValue)); }  }
GuavaUtils { public static <K, V> ImmutableListMultimap<K, V> toMultimap(Map<K, List<V>> rights) { return rights.entrySet() .stream() .flatMap(e -> e.getValue().stream().map(right -> Pair.of(e.getKey(), right))) .collect(Guavate.toImmutableListMultimap(Pair::getKey, Pair::getValue)); }  static ImmutableListMultimap<K, V> toMultimap(Map<K, List<V>> rights); }
GuavaUtils { public static <K, V> ImmutableListMultimap<K, V> toMultimap(Map<K, List<V>> rights) { return rights.entrySet() .stream() .flatMap(e -> e.getValue().stream().map(right -> Pair.of(e.getKey(), right))) .collect(Guavate.toImmutableListMultimap(Pair::getKey, Pair::getValue)); }  static ImmutableListMultimap<K, V> toMultimap(Map<K, List<V>> rights);  }