List of usage examples for com.google.common.collect ImmutableSet.Builder addAll
boolean addAll(Collection<? extends E> c);
From source file:co.signal.loadgen.example.TagserveLoadGenerator.java
private ImmutableSet<Long> nextTags(SiteConfig siteConfig, Set<Long> pages) { ImmutableSet.Builder<Long> tags = ImmutableSet.builder(); Map<String, PageConfig> pageConfigs = siteConfig.getPages(); for (Long pageId : pages) { PageConfig pageConfig = pageConfigs.get(String.valueOf(pageId)); tags.addAll(pageConfig.getTags()); }//from w ww. jav a2s . co m return tags.build(); }
From source file:com.brighttag.agathon.service.impl.PerDataCenterSeedService.java
@Override public ImmutableSet<String> getSeeds(CassandraRing ring) { ImmutableSet.Builder<String> seedBuilder = ImmutableSet.builder(); ImmutableSetMultimap<String, CassandraInstance> dataCenterToInstanceMap = buildDataCenterToInstanceMap( ring.getInstances());/*from w ww . ja v a2s. c om*/ for (String dc : dataCenterToInstanceMap.keySet()) { seedBuilder.addAll(getSeeds(dc, dataCenterToInstanceMap.get(dc))); } return seedBuilder.build(); }
From source file:com.google.devtools.build.lib.sandbox.DarwinSandboxedStrategy.java
@Override protected ImmutableSet<Path> getInaccessiblePaths() { ImmutableSet.Builder<Path> inaccessiblePaths = ImmutableSet.builder(); inaccessiblePaths.addAll(super.getInaccessiblePaths()); inaccessiblePaths.add(blazeDirs.getWorkspace()); inaccessiblePaths.add(execRoot);//from ww w.j a v a 2s. com return inaccessiblePaths.build(); }
From source file:org.gradle.initialization.GradleApiSpecAggregator.java
private Spec mergeSpecsOf(List<Class<? extends GradleApiSpecProvider>> providers) { final ImmutableSet.Builder<String> exportedPackages = ImmutableSet.builder(); final ImmutableSet.Builder<String> exportedResourcePrefixes = ImmutableSet.builder(); for (Class<? extends GradleApiSpecProvider> provider : providers) { Spec spec = specFrom(provider);/*from w ww.java 2 s . com*/ exportedPackages.addAll(spec.getExportedPackages()); exportedResourcePrefixes.addAll(spec.getExportedResourcePrefixes()); } return new DefaultSpec(exportedPackages.build(), exportedResourcePrefixes.build()); }
From source file:net.shibboleth.idp.attribute.IdPAttribute.java
/** * Replaces the existing encoders for this attribute with the given encoders. * /*from w w w . ja v a 2 s . c o m*/ * @param newEncoders the new encoders for this attribute */ public void setEncoders(@Nullable @NullableElements final Collection<AttributeEncoder<?>> newEncoders) { final ImmutableSet.Builder<AttributeEncoder<?>> builder = ImmutableSet.builder(); if (newEncoders != null) { builder.addAll(Collections2.filter(newEncoders, Predicates.notNull())); } encoders = builder.build(); }
From source file:com.github.rinde.logistics.pdptw.solver.optaplanner.MovePair.java
@Override public Collection<? extends Object> getPlanningEntities() { if (planningEntities == null) { final ImmutableSet.Builder<Visit> entityBuilder = ImmutableSet.builder(); for (final Changeset c : changesets) { entityBuilder.addAll(isUndo ? c.getOriginalEntities() : c.getTargetEntities()); }/*w w w . j av a 2 s.com*/ planningEntities = entityBuilder.build(); } return planningEntities; }
From source file:com.github.rinde.logistics.pdptw.solver.optaplanner.MovePair.java
@Override public Collection<? extends Object> getPlanningValues() { if (planningValues == null) { final ImmutableSet.Builder<Visit> valuesBuilder = ImmutableSet.builder(); for (final Changeset c : changesets) { valuesBuilder.addAll(isUndo ? c.getOriginalValues() : c.getTargetValues()); }/*from w ww . j a v a2s .c o m*/ planningValues = valuesBuilder.build(); } return planningValues; }
From source file:com.google.devtools.build.skyframe.DirtyBuildingState.java
/** * Returns the remaining direct deps that have not been checked. If {@code preservePosition} is * true, this method is non-mutating. If {@code preservePosition} is false, the caller must * process the returned set, and so subsequent calls to this method will return the empty set. *//*w w w . j av a2 s .co m*/ Set<SkyKey> getAllRemainingDirtyDirectDeps(boolean preservePosition) { Preconditions.checkState(isDirty(), this); ImmutableSet.Builder<SkyKey> result = ImmutableSet.builder(); for (int ind = dirtyDirectDepIndex; ind < lastBuildDirectDeps.listSize(); ind++) { result.addAll(lastBuildDirectDeps.get(ind)); } if (!preservePosition) { dirtyDirectDepIndex = lastBuildDirectDeps.listSize(); } return result.build(); }
From source file:dagger.internal.codegen.BindingGraphPlugins.java
/** * Calls {@link BindingGraphPlugin#visitGraph(BindingGraph, DiagnosticReporter)} on each of the * SPI plugins/*from w w w. j a v a 2 s. c o m*/ * * @return the kinds of diagnostics that were reported */ // TODO(ronshapiro): Should we validate the uniqueness of plugin names? ImmutableSet<Diagnostic.Kind> visitGraph(BindingGraph graph) { ImmutableSet.Builder<Diagnostic.Kind> diagnosticKinds = ImmutableSet.builder(); for (BindingGraphPlugin plugin : plugins) { DiagnosticReporterImpl reporter = diagnosticReporterFactory.reporter(graph, plugin); plugin.visitGraph(graph, reporter); diagnosticKinds.addAll(reporter.reportedDiagnosticKinds()); } return diagnosticKinds.build(); }
From source file:com.android.build.gradle.internal.incremental.fixture.ClassEnhancement.java
@Override public Statement apply(final Statement base, final Description description) { return new Statement() { @Override//from ww w. ja v a 2s.c om public void evaluate() throws Throwable { mCompileOutputFolders = getCompileFolders(mResourceBase); final ClassLoader mainClassLoader = this.getClass().getClassLoader(); mEnhancedClassLoaders = setUpEnhancedClassLoaders(mainClassLoader, mCompileOutputFolders, tracing); mEnhancedClasses = findEnhancedClasses(mCompileOutputFolders); ImmutableSet.Builder<String> baseClassesBuilder = ImmutableSet.builder(); for (List<String> classNames : mEnhancedClasses.values()) { baseClassesBuilder.addAll(classNames); } mBaseClasses = baseClassesBuilder.build(); base.evaluate(); } }; }