/** * Returns an immutable set multimap containing the same mappings as {@code multimap}. The * generated multimap's key and value orderings correspond to the iteration ordering of the {@code * multimap.asMap()} view. Repeated occurrences of an entry in the multimap after the first are * ignored. * * <p>Despite the method name, this method attempts to avoid actually copying the data when it is * safe to do so. The exact circumstances under which a copy will or will not be performed are * undocumented and subject to change. * * @throws NullPointerException if any key or value in {@code multimap} is null */ public static <K, V> ImmutableSetMultimap<K, V> copyOf( Multimap<? extends K, ? extends V> multimap) { return copyOf(multimap, null); }
public PrincipalPrivileges( Multimap<String, HivePrivilegeInfo> userPrivileges, Multimap<String, HivePrivilegeInfo> rolePrivileges) { this.userPrivileges = ImmutableSetMultimap.copyOf(requireNonNull(userPrivileges, "userPrivileges is null")); this.rolePrivileges = ImmutableSetMultimap.copyOf(requireNonNull(rolePrivileges, "rolePrivileges is null")); }
private TpchIndexSpec(SetMultimap<TpchScaledTable, Set<String>> spec) { this.spec = ImmutableSetMultimap.copyOf(requireNonNull(spec, "spec is null")); }
public IndexSourceContext(SetMultimap<Symbol, Integer> indexLookupToProbeInput) { this.indexLookupToProbeInput = ImmutableSetMultimap.copyOf(requireNonNull(indexLookupToProbeInput, "indexLookupToProbeInput is null")); }
public SetMultimap<String, String> getTags() { return (ImmutableSetMultimap.copyOf(tags)); }
/** * Returns an immutable set multimap containing the same mappings as {@code multimap}. The * generated multimap's key and value orderings correspond to the iteration ordering of the {@code * multimap.asMap()} view. Repeated occurrences of an entry in the multimap after the first are * ignored. * * <p>Despite the method name, this method attempts to avoid actually copying the data when it is * safe to do so. The exact circumstances under which a copy will or will not be performed are * undocumented and subject to change. * * @throws NullPointerException if any key or value in {@code multimap} is null */ public static <K, V> ImmutableSetMultimap<K, V> copyOf( Multimap<? extends K, ? extends V> multimap) { return copyOf(multimap, null); }
@Override <K extends Comparable<K>, V extends Comparable<V>> SetMultimap<K, V> create( Multimap<K, V> contents) { return ImmutableSetMultimap.copyOf(contents); } };
@Override protected SetMultimap<String, String> create(Entry<String, String>[] entries) { return ImmutableSetMultimap.copyOf(Arrays.asList(entries)); } }
public static ApiDiff fromMembers( Set<String> unsupportedClasses, Multimap<String, ClassMemberKey> unsupportedMembersByClass) { return new AutoValue_ApiDiff( ImmutableSet.copyOf(unsupportedClasses), ImmutableSetMultimap.copyOf(unsupportedMembersByClass)); }
public void testCopyOfNullValue() { HashMultimap<String, Integer> input = HashMultimap.create(); input.putAll("foo", Arrays.asList(1, null, 3)); try { ImmutableSetMultimap.copyOf(input); fail(); } catch (NullPointerException expected) { } }
@Override protected Map<String, Collection<Integer>> makePopulatedMap() { Multimap<String, Integer> delegate = HashMultimap.create(); populate(delegate); return ImmutableSetMultimap.copyOf(delegate).asMap(); } }
public void testCopyOfEmpty() { HashMultimap<String, Integer> input = HashMultimap.create(); Multimap<String, Integer> multimap = ImmutableSetMultimap.copyOf(input); assertEquals(multimap, input); assertEquals(input, multimap); }
public void testCopyOfNullKey() { HashMultimap<String, Integer> input = HashMultimap.create(); input.put(null, 1); try { ImmutableSetMultimap.copyOf(input); fail(); } catch (NullPointerException expected) { } }
public void testCopyOfImmutableSetMultimap() { Multimap<String, Integer> multimap = createMultimap(); assertSame(multimap, ImmutableSetMultimap.copyOf(multimap)); }
public void testCopyOf() { HashMultimap<String, Integer> input = HashMultimap.create(); input.put("foo", 1); input.put("bar", 2); input.put("foo", 3); Multimap<String, Integer> multimap = ImmutableSetMultimap.copyOf(input); assertEquals(multimap, input); assertEquals(input, multimap); }
public void testCopyOfWithDuplicates() { ArrayListMultimap<Object, Object> input = ArrayListMultimap.create(); input.put("foo", 1); input.put("bar", 2); input.put("foo", 3); input.put("foo", 1); ImmutableSetMultimap<Object, Object> copy = ImmutableSetMultimap.copyOf(input); assertEquals(3, copy.size()); }
.forEach(pipeline -> connections.put(streamConnection.streamId(), pipeline)); ImmutableSetMultimap<String, Pipeline> streamPipelineConnections = ImmutableSetMultimap.copyOf(connections);
private static ImmutableMultimap<ZipPath, ModuleEntry> discardAbiDirsWithTooFewFiles( ImmutableMultimap<ZipPath, ModuleEntry> libFilesByAbiDir) { int maxAbiFiles = libFilesByAbiDir.asMap().values().stream().mapToInt(Collection::size).max().orElse(0); // Create a set-based multimap for fast look-ups. return ImmutableSetMultimap.copyOf( Multimaps.filterKeys( libFilesByAbiDir, abiDir -> libFilesByAbiDir.get(abiDir).size() == maxAbiFiles)); }
/** * Returns a newly-created immutable set multimap. */ @Override public ImmutableSetMultimap<K, V> build() { return copyOf(builderMultimap); } }
@Nonnull public ImmutableSetMultimap<E, E> generateHierarchy(@Nonnull Collection<Edge> edges, List<OWLOntologyChange> changeList) { Multimap<E, E> parentChildMap = HashMultimap.create(); for (Edge edge : edges) { generateChangesForEdge(edge, changeList, parentChildMap); } return ImmutableSetMultimap.copyOf(parentChildMap); }