List of usage examples for com.google.common.collect ImmutableSet.Builder addAll
boolean addAll(Collection<? extends E> c);
From source file:org.openqa.selenium.remote.RemoteLogs.java
public Set<String> getAvailableLogTypes() { Object raw = executeMethod.execute(DriverCommand.GET_AVAILABLE_LOG_TYPES, null); @SuppressWarnings("unchecked") List<String> rawList = (List<String>) raw; ImmutableSet.Builder<String> builder = new ImmutableSet.Builder<String>(); for (String logType : rawList) { builder.add(logType);/*ww w . ja va 2 s. com*/ } builder.addAll(getAvailableLocalLogs()); return builder.build(); }
From source file:com.facebook.buck.rust.RustTestDescription.java
@Override public Iterable<BuildTarget> findDepsForTargetFromConstructorArgs(BuildTarget buildTarget, CellPathResolver cellRoots, RustTestDescription.Arg constructorArg) { ImmutableSet.Builder<BuildTarget> deps = ImmutableSet.builder(); ToolProvider compiler = rustBuckConfig.getRustCompiler(); deps.addAll(compiler.getParseTimeDeps()); deps.addAll(CxxPlatforms.getParseTimeDeps(cxxPlatforms.getValues())); return deps.build(); }
From source file:com.facebook.buck.gwt.GwtBinary.java
/** * The classpath entries needed to run {@code com.google.gwt.dev.Compiler} to build the module * specified by {@link #modules}./*from w w w. ja va2 s .c om*/ */ @VisibleForTesting Iterable<Path> getClasspathEntries() { ImmutableSet.Builder<Path> classpathEntries = ImmutableSet.builder(); classpathEntries.addAll(gwtModuleJars); for (BuildRule dep : getDeclaredDeps()) { if (!(dep instanceof JavaLibrary)) { continue; } JavaLibrary javaLibrary = (JavaLibrary) dep; for (Path path : javaLibrary.getOutputClasspaths()) { classpathEntries.add(path); } } return classpathEntries.build(); }
From source file:com.facebook.buck.features.gwt.GwtBinary.java
/** * The classpath entries needed to run {@code com.google.gwt.dev.Compiler} to build the module * specified by {@link #modules}.//from w w w . jav a2 s . com */ @VisibleForTesting Iterable<Path> getClasspathEntries(SourcePathResolver pathResolver) { ImmutableSet.Builder<Path> classpathEntries = ImmutableSet.builder(); classpathEntries.addAll(pathResolver.getAllAbsolutePaths(gwtModuleJars)); for (BuildRule dep : getDeclaredDeps()) { if (!(dep instanceof JavaLibrary)) { continue; } JavaLibrary javaLibrary = (JavaLibrary) dep; for (SourcePath path : javaLibrary.getOutputClasspaths()) { classpathEntries.add(pathResolver.getAbsolutePath(path)); } } return classpathEntries.build(); }
From source file:io.prestosql.plugin.cassandra.CassandraTokenSplitManager.java
private Set<TokenRange> unwrap(Set<TokenRange> tokenRanges) { ImmutableSet.Builder<TokenRange> result = ImmutableSet.builder(); for (TokenRange range : tokenRanges) { result.addAll(range.unwrap()); }/* ww w . jav a 2 s . c o m*/ return result.build(); }
From source file:com.facebook.buck.thrift.ThriftPythonEnhancer.java
@Override public ImmutableSet<String> getOptions(BuildTarget target, ThriftConstructorArg args) { // Don't allow the "twisted" or "asyncio" parameters to be passed in via the options // parameter, as we use dedicated flavors to handle them. if (args.pyOptions.contains("twisted")) { throw new HumanReadableException("%s: parameter \"py_options\": cannot specify \"twisted\" as an option" + " -- use the \"#%s\" flavor instead", target, PYTHON_TWISTED_FLAVOR); }/*from w ww . ja v a 2s .c o m*/ if (args.pyOptions.contains("asyncio")) { throw new HumanReadableException("%s: parameter \"py_options\": cannot specify \"asyncio\" as an option" + " -- use the \"#%s\" flavor instead", target, PYTHON_ASYNCIO_FLAVOR); } ImmutableSet.Builder<String> options = ImmutableSet.builder(); options.addAll(args.pyOptions); if (type == Type.TWISTED) { options.add("twisted"); } else if (type == Type.ASYNCIO) { options.add("asyncio"); } return options.build(); }
From source file:org.eel.kitchen.jsonschema.keyword.AdditionalPropertiesKeywordValidator.java
public AdditionalPropertiesKeywordValidator(final JsonNode schema) { super("additionalProperties", NodeType.OBJECT); additionalOK = schema.get(keyword).asBoolean(true); if (additionalOK) { properties = Collections.emptySet(); patternProperties = Collections.emptySet(); return;/* ww w . j a va2 s . c o m*/ } ImmutableSet.Builder<String> builder; builder = new ImmutableSet.Builder<String>(); if (schema.has("properties")) builder.addAll(schema.get("properties").fieldNames()); properties = builder.build(); builder = new ImmutableSet.Builder<String>(); if (schema.has("patternProperties")) builder.addAll(schema.get("patternProperties").fieldNames()); patternProperties = builder.build(); }
From source file:dagger.producers.internal.SetProducer.java
/** * Returns a future {@link Set} whose iteration order is that of the elements given by each of the * producers, which are invoked in the order given at creation. * * <p>If any of the delegate collections, or any elements therein, are null, then this future will * fail with a NullPointerException.// www. j a va 2 s .co m * * <p>Canceling this future will attempt to cancel all of the component futures, and if any of the * delegate futures fails or is canceled, this one is, too. * * @throws NullPointerException if any of the delegate producers return null */ @Override public ListenableFuture<Set<T>> compute() { List<ListenableFuture<T>> individualFutures = new ArrayList<ListenableFuture<T>>( individualProducers.size()); for (Producer<T> producer : individualProducers) { individualFutures.add(checkNotNull(producer.get())); } // Presize the list of collections produced by the amount of collectionProducers, with one more // for the consolidate individualFutures from Futures.allAsList. List<ListenableFuture<? extends Collection<T>>> futureCollections = new ArrayList<ListenableFuture<? extends Collection<T>>>( collectionProducers.size() + 1); futureCollections.add(Futures.allAsList(individualFutures)); for (Producer<Collection<T>> producer : collectionProducers) { futureCollections.add(checkNotNull(producer.get())); } return transform(Futures.allAsList(futureCollections), new Function<List<Collection<T>>, Set<T>>() { @Override public Set<T> apply(List<Collection<T>> sets) { ImmutableSet.Builder<T> builder = ImmutableSet.builder(); for (Collection<T> set : sets) { builder.addAll(set); } return builder.build(); } }, directExecutor()); }
From source file:com.tngtech.archunit.library.plantuml.JavaClassDiagramAssociation.java
Set<String> getTargetPackageIdentifiers(final JavaClass javaClass) { ImmutableSet.Builder<String> result = ImmutableSet.builder(); for (PlantUmlComponent target : getComponentOf(javaClass).getDependencies()) { result.addAll(getPackageIdentifiersFromComponentOf(target)); }//from w w w.java2 s. c o m return result.build(); }
From source file:com.facebook.buck.rules.TargetNode.java
public ImmutableSet<BuildTarget> getDeps() { ImmutableSet.Builder<BuildTarget> builder = ImmutableSet.builder(); builder.addAll(getDeclaredDeps()); builder.addAll(getExtraDeps());//w ww.ja va 2 s . c o m return builder.build(); }