private static void createSymlinks(Path path, Collection<ExternalDependency> dependencies) { if (!path.toFile().exists() && !path.toFile().mkdirs()) { throw new RuntimeException(String.format("Couldn't create %s when creating symlinks", path)); } SetMultimap<VersionlessDependency, ExternalDependency> nameToDependencyMap = MultimapBuilder.hashKeys().hashSetValues().build(); dependencies.forEach( dependency -> nameToDependencyMap.put(dependency.getVersionless(), dependency)); dependencies.forEach( dependency -> { FileUtil.symlink( path.resolve(dependency.getDependencyFileName()), dependency.getRealDependencyFile().toPath()); dependency .getRealSourceFile() .ifPresent( file -> FileUtil.symlink( path.resolve(dependency.getSourceFileName()), file.toPath())); }); } }
@Override protected WebTarget getBaseResource() { return new OkHttpWebTarget( okHttpClient, baseUrl, ImmutableList.of(), MultimapBuilder.hashKeys().hashSetValues().build() ); }
synchronized void updateCache() { Multimap<String, Location> newClassNameLocations = HashMultimap.create(); for (ClassLoader loader : getKnownClassLoaders()) { updateCache(loader, newClassNameLocations); } updateCacheWithClasspathClasses(newClassNameLocations); updateCacheWithBootstrapClasses(newClassNameLocations); if (!newClassNameLocations.isEmpty()) { // multimap that sorts keys and de-dups values while maintains value ordering SetMultimap<String, Location> newMap = MultimapBuilder.treeKeys().linkedHashSetValues().build(); newMap.putAll(classNameLocations); newMap.putAll(newClassNameLocations); classNameLocations = ImmutableMultimap.copyOf(newMap); } }
@Override public <K extends K0, V extends V0> SortedSetMultimap<K, V> build( Multimap<? extends K, ? extends V> multimap) { return (SortedSetMultimap<K, V>) super.build(multimap); } }
@Override public ImmutableList<ImmutableSet<E>> allEquivalenceClasses() { SetMultimap<Node<E>, E> groupsTmp = MultimapBuilder.linkedHashKeys().linkedHashSetValues().build(); for (Node<E> elem : elmap.values()) { groupsTmp.put(findRoot(elem), elem.element); } ImmutableList.Builder<ImmutableSet<E>> result = ImmutableList.builder(); for (Set<E> group : asMap(groupsTmp).values()) { result.add(ImmutableSet.copyOf(group)); } return result.build(); }
public void testGenerics_gwtCompatible() { ListMultimap<String, Integer> a = MultimapBuilder.hashKeys().arrayListValues().<String, Integer>build(); SortedSetMultimap<String, Integer> b = MultimapBuilder.linkedHashKeys().treeSetValues().<String, Integer>build(); SetMultimap<String, Integer> c = MultimapBuilder.treeKeys(String.CASE_INSENSITIVE_ORDER) .hashSetValues().<String, Integer>build(); }
@GwtIncompatible // doesn't build without explicit type parameters on build() methods public void testGenerics() { ListMultimap<String, Integer> a = MultimapBuilder.hashKeys().arrayListValues().build(); SortedSetMultimap<String, Integer> b = MultimapBuilder.linkedHashKeys().treeSetValues().build(); SetMultimap<String, Integer> c = MultimapBuilder.treeKeys(String.CASE_INSENSITIVE_ORDER).hashSetValues().build(); }
@Override public <K extends K0, V extends V0> SortedSetMultimap<K, V> build( Multimap<? extends K, ? extends V> multimap) { return (SortedSetMultimap<K, V>) super.build(multimap); } }
@Override public <K extends K0, V extends V0> SortedSetMultimap<K, V> build( Multimap<? extends K, ? extends V> multimap) { return (SortedSetMultimap<K, V>) super.build(multimap); } }
/** * Creates a new builder. The returned builder is equivalent to the builder * generated by {@link ImmutableSetMultimap#builder}. */ public Builder() { super(MultimapBuilder.linkedHashKeys().linkedHashSetValues().<K, V> build()); }
@Override public <K extends K0, V extends V0> SortedSetMultimap<K, V> build( Multimap<? extends K, ? extends V> multimap) { return (SortedSetMultimap<K, V>) super.build(multimap); } }
/** * Copy constructor. * * @param other The constructed object is a replicated copy of this element. */ public ReachingUses(ReachingUses other) { mayUseMap = MultimapBuilder.hashKeys().hashSetValues().build(other.mayUseMap); }
/** * Returns a multimap whose keys are base directories and whose values are potential locations of * wire profile files. */ Multimap<Path, String> pathsToAttempt(Set<Location> protoLocations) { Multimap<Path, String> result = MultimapBuilder.linkedHashKeys().linkedHashSetValues().build(); for (Location location : protoLocations) { pathsToAttempt(result, location); } return result; }
@Override public <K extends K0, V extends V0> SortedSetMultimap<K, V> build( Multimap<? extends K, ? extends V> multimap) { return (SortedSetMultimap<K, V>) super.build(multimap); } }
@Override public <K extends K0, V extends V0> SortedSetMultimap<K, V> build( Multimap<? extends K, ? extends V> multimap) { return (SortedSetMultimap<K, V>) super.build(multimap); } }
/** * Returns a multimap whose keys are base directories and whose values are potential locations of * wire profile files. */ Multimap<Path, String> pathsToAttempt(Set<Location> protoLocations) { Multimap<Path, String> result = MultimapBuilder.linkedHashKeys().linkedHashSetValues().build(); for (Location location : protoLocations) { pathsToAttempt(result, location); } return result; }
@Override public <K extends K0, V extends V0> SortedSetMultimap<K, V> build( Multimap<? extends K, ? extends V> multimap) { return (SortedSetMultimap<K, V>) super.build(multimap); } }
public void testGenerics_gwtCompatible() { ListMultimap<String, Integer> a = MultimapBuilder.hashKeys().arrayListValues().<String, Integer>build(); SortedSetMultimap<String, Integer> b = MultimapBuilder.linkedHashKeys().treeSetValues().<String, Integer>build(); SetMultimap<String, Integer> c = MultimapBuilder.treeKeys(String.CASE_INSENSITIVE_ORDER) .hashSetValues() .<String, Integer>build(); }
@GwtIncompatible // doesn't build without explicit type parameters on build() methods public void testGenerics() { ListMultimap<String, Integer> a = MultimapBuilder.hashKeys().arrayListValues().build(); SortedSetMultimap<String, Integer> b = MultimapBuilder.linkedHashKeys().treeSetValues().build(); SetMultimap<String, Integer> c = MultimapBuilder.treeKeys(String.CASE_INSENSITIVE_ORDER).hashSetValues().build(); }
@Override public <K extends K0, V extends V0> SortedSetMultimap<K, V> build( Multimap<? extends K, ? extends V> multimap) { return (SortedSetMultimap<K, V>) super.build(multimap); } }