List of usage examples for com.google.common.collect ImmutableSet.Builder addAll
boolean addAll(Collection<? extends E> c);
From source file:com.facebook.buck.features.haskell.HaskellHaddockRule.java
public static HaskellHaddockRule from(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, BuildRuleParams buildRuleParams, SourcePathRuleFinder ruleFinder, Tool haddockTool, ImmutableList<String> flags, ImmutableSet<HaskellHaddockInput> inputs) { ImmutableSet.Builder<SourcePath> ifacesBuilder = ImmutableSet.builder(); ImmutableSet.Builder<SourcePath> outDirsBuilder = ImmutableSet.builder(); for (HaskellHaddockInput i : inputs) { ifacesBuilder.addAll(i.getInterfaces()); outDirsBuilder.addAll(i.getHaddockOutputDirs()); }//from w ww . jav a 2 s. c o m ImmutableSet<SourcePath> ifaces = ifacesBuilder.build(); ImmutableSet<SourcePath> outDirs = outDirsBuilder.build(); Supplier<ImmutableSortedSet<BuildRule>> declaredDeps = MoreSuppliers.memoize(() -> ImmutableSortedSet .<BuildRule>naturalOrder().addAll(BuildableSupport.getDepsCollection(haddockTool, ruleFinder)) .addAll(ruleFinder.filterBuildRuleInputs(ifaces)).addAll(ruleFinder.filterBuildRuleInputs(outDirs)) .build()); return new HaskellHaddockRule(buildTarget, projectFilesystem, buildRuleParams.withDeclaredDeps(declaredDeps).withoutExtraDeps(), haddockTool, flags, ifaces, outDirs); }
From source file:org.apache.aurora.scheduler.base.JobKeys.java
/** * Attempt to extract job keys from the given query if it is job scoped. * * @param query Query to extract the keys from. * @return A present if keys can be extracted, absent otherwise. *//* w ww .ja v a2s .com*/ public static Optional<Set<IJobKey>> from(Query.Builder query) { if (Query.isJobScoped(query)) { ITaskQuery taskQuery = query.get(); ImmutableSet.Builder<IJobKey> builder = ImmutableSet.builder(); if (taskQuery.isSetJobName()) { builder.add(from(taskQuery.getRole(), taskQuery.getEnvironment(), taskQuery.getJobName())); } builder.addAll(taskQuery.getJobKeys()); return Optional.of(assertValid(builder.build())); } else { return Optional.absent(); } }
From source file:com.tngtech.archunit.junit.ArchRuleDeclaration.java
static Set<ArchRuleDeclaration<?>> toDeclarations(ArchRules rules, Class<?> testClass, Class<? extends Annotation> archTestAnnotationType, boolean forceIgnore) { ImmutableSet.Builder<ArchRuleDeclaration<?>> result = ImmutableSet.builder(); Class<?> definitionLocation = rules.getDefinitionLocation(); for (Field field : getAllFields(definitionLocation, withAnnotation(archTestAnnotationType))) { result.addAll(archRuleDeclarationsFrom(testClass, field, definitionLocation, archTestAnnotationType, forceIgnore));//w ww. j av a 2s. co m } for (Method method : getAllMethods(definitionLocation, withAnnotation(archTestAnnotationType))) { result.add(ArchRuleDeclaration.from(testClass, method, definitionLocation, forceIgnore)); } return result.build(); }
From source file:io.prestosql.sql.planner.PlanFragment.java
private static void findSources(PlanNode node, Set<PlanNodeId> nodeIds, ImmutableSet.Builder<PlanNode> nodes) { if (nodeIds.contains(node.getId())) { nodes.add(node);//from w w w.j a v a 2 s . com } for (PlanNode source : node.getSources()) { nodes.addAll(findSources(source, nodeIds)); } }
From source file:com.facebook.buck.cxx.AbstractCxxIncludePaths.java
/** * Merge all the given {@link CxxIncludePaths}. * * Combinines their path lists, deduping them (keeping the earlier of the repeated instance). *//* w ww. j a v a 2 s .c om*/ public static CxxIncludePaths concat(Iterator<CxxIncludePaths> itemIter) { ImmutableSet.Builder<CxxHeaders> ipathBuilder = ImmutableSet.<CxxHeaders>builder(); ImmutableSet.Builder<FrameworkPath> fpathBuilder = ImmutableSet.<FrameworkPath>builder(); while (itemIter.hasNext()) { CxxIncludePaths item = itemIter.next(); ipathBuilder.addAll(item.getIPaths()); fpathBuilder.addAll(item.getFPaths()); } return CxxIncludePaths.of(ipathBuilder.build(), fpathBuilder.build()); }
From source file:com.facebook.buck.cxx.toolchain.CxxPlatforms.java
public static Iterable<BuildTarget> findDepsForTargetFromConstructorArgs( CxxPlatformsProvider cxxPlatformsProvider, BuildTarget buildTarget, Optional<Flavor> defaultCxxPlatformFlavor) { ImmutableSet.Builder<BuildTarget> deps = ImmutableSet.builder(); // Get any parse time deps from the C/C++ platforms. deps.addAll(getCxxPlatform(cxxPlatformsProvider, buildTarget, defaultCxxPlatformFlavor).getParseTimeDeps()); return deps.build(); }
From source file:com.facebook.buck.cxx.AbstractCxxPreprocessorInput.java
public static CxxPreprocessorInput concat(Iterable<CxxPreprocessorInput> inputs) { ImmutableMultimap.Builder<CxxSource.Type, String> preprocessorFlags = ImmutableMultimap.builder(); ImmutableList.Builder<CxxHeaders> headers = ImmutableList.builder(); ImmutableSet.Builder<FrameworkPath> frameworks = ImmutableSet.builder(); ImmutableSet.Builder<BuildTarget> rules = ImmutableSet.builder(); for (CxxPreprocessorInput input : inputs) { preprocessorFlags.putAll(input.getPreprocessorFlags()); headers.addAll(input.getIncludes()); frameworks.addAll(input.getFrameworks()); rules.addAll(input.getRules());/* ww w . j a v a2 s . c o m*/ } return CxxPreprocessorInput.of(preprocessorFlags.build(), headers.build(), frameworks.build(), rules.build()); }
From source file:com.google.acai.Dependencies.java
/** * Returns the set of services which {@code testingService} depends upon. *///from w w w .j a v a 2s. c o m private static ImmutableSet<TestingService> getDependencies(TestingService testingService, Multimap<Class<? extends TestingService>, TestingService> servicesByClass) { if (!testingService.getClass().isAnnotationPresent(DependsOn.class)) { return ImmutableSet.of(); } ImmutableSet.Builder<TestingService> dependencies = ImmutableSet.builder(); DependsOn dependsOn = testingService.getClass().getAnnotation(DependsOn.class); for (Class<? extends TestingService> serviceClass : dependsOn.value()) { dependencies.addAll(servicesByClass.get(serviceClass)); } return dependencies.build(); }
From source file:com.xemantic.tadedon.configuration.Configurations.java
public static Set<String> getDefaultConfigurations() { ImmutableSet.Builder<String> builder = ImmutableSet.<String>builder(); List<URL> configurationLists = MoreResources.getResources(DEFAULT_CONFIGURATION_LIST); for (URL url : configurationLists) { builder.addAll(getLines(url)); }/*from w w w. j a va 2s.c om*/ return builder.build(); }
From source file:dagger2.internal.codegen.writer.Snippet.java
public static Snippet makeParametersSnippet(Iterable<Snippet> parameterSnippets) { Iterator<Snippet> iterator = parameterSnippets.iterator(); StringBuilder stringBuilder = new StringBuilder(); ImmutableSet.Builder<TypeName> typesBuilder = ImmutableSet.builder(); ImmutableList.Builder<Object> argsBuilder = ImmutableList.builder(); if (iterator.hasNext()) { Snippet firstSnippet = iterator.next(); stringBuilder.append(firstSnippet.format()); typesBuilder.addAll(firstSnippet.types()); argsBuilder.addAll(firstSnippet.args()); }/*from w w w .ja va 2s .co m*/ while (iterator.hasNext()) { Snippet nextSnippet = iterator.next(); stringBuilder.append(", ").append(nextSnippet.format()); typesBuilder.addAll(nextSnippet.types()); argsBuilder.addAll(nextSnippet.args()); } return new Snippet(stringBuilder.toString(), typesBuilder.build(), argsBuilder.build()); }