List of usage examples for com.google.common.collect ImmutableList.Builder addAll
boolean addAll(Collection<? extends E> c);
From source file:org.apache.james.transport.mailets.UseHeaderRecipients.java
private Collection<MailAddress> readMailAddresses(String headerPart) throws AddressException { AddressList addressList = LenientAddressParser.DEFAULT.parseAddressList(MimeUtil.unfold(headerPart)); ImmutableList.Builder<Mailbox> mailboxList = ImmutableList.builder(); for (Address address : addressList) { mailboxList.addAll(convertAddressToMailboxCollection(address)); }/*from w ww . ja v a 2s. co m*/ return FluentIterable.from(mailboxList.build()).transform(TO_MAIL_ADDRESS).toList(); }
From source file:gobblin.data.management.copy.ConcurrentBoundedWorkUnitList.java
/** * Get the {@link List} of {@link WorkUnit}s in this container. *///from ww w.j ava2 s . c om public List<WorkUnit> getWorkUnits() { ImmutableList.Builder<WorkUnit> allWorkUnits = ImmutableList.builder(); for (List<WorkUnit> workUnits : this.workUnitsMap.values()) { allWorkUnits.addAll(workUnits); } return allWorkUnits.build(); }
From source file:org.apache.calcite.jdbc.SimpleCalciteSchema.java
protected void addImplicitFunctionsToBuilder(ImmutableList.Builder<Function> builder, String name, boolean caseSensitive) { Collection<Function> functions = schema.getFunctions(name); if (functions != null) { builder.addAll(functions); }// w ww.j a va2s .c o m }
From source file:is.illuminati.block.spyros.garmin.model.Activity.java
public ImmutableList<TrackPoint> getTrackPoints() { ImmutableList.Builder<TrackPoint> builder = ImmutableList.builder(); for (Lap lap : laps) { builder.addAll(lap.getTrackPoints()); }//from w ww.jav a2 s . c o m return builder.build(); }
From source file:io.prestosql.sql.tree.FunctionCall.java
@Override public List<Node> getChildren() { ImmutableList.Builder<Node> nodes = ImmutableList.builder(); window.ifPresent(nodes::add);// w w w .j a va 2 s .c o m filter.ifPresent(nodes::add); orderBy.map(OrderBy::getSortItems).map(nodes::addAll); nodes.addAll(arguments); return nodes.build(); }
From source file:com.facebook.buck.swift.SwiftCompile.java
private SwiftCompileStep makeCompileStep(SourcePathResolver resolver) { ImmutableList.Builder<String> compilerCommand = ImmutableList.builder(); compilerCommand.addAll(swiftCompiler.getCommandPrefix(resolver)); if (bridgingHeader.isPresent()) { compilerCommand.add("-import-objc-header", resolver.getRelativePath(bridgingHeader.get()).toString()); }//from w w w . j a va2 s. c o m final Function<FrameworkPath, Path> frameworkPathToSearchPath = CxxDescriptionEnhancer .frameworkPathToSearchPath(cxxPlatform, resolver); compilerCommand.addAll(frameworks.stream().map(frameworkPathToSearchPath::apply) .flatMap(searchPath -> ImmutableSet.of("-F", searchPath.toString()).stream()).iterator()); compilerCommand.addAll(MoreIterables.zipAndConcat(Iterables.cycle("-Xcc"), getSwiftIncludeArgs(resolver))); compilerCommand.addAll(MoreIterables.zipAndConcat(Iterables.cycle(INCLUDE_FLAG), FluentIterable.from(getDeps()).filter(SwiftCompile.class) .transform(SourcePaths.getToBuildTargetSourcePath()) .transform(input -> resolver.getAbsolutePath(input).toString()))); Optional<Iterable<String>> configFlags = swiftBuckConfig.getFlags(); if (configFlags.isPresent()) { compilerCommand.addAll(configFlags.get()); } boolean hasMainEntry = FluentIterable.from(srcs).firstMatch(input -> SWIFT_MAIN_FILENAME .equalsIgnoreCase(resolver.getAbsolutePath(input).getFileName().toString())).isPresent(); compilerCommand.add("-enable-testing", "-c", enableObjcInterop ? "-enable-objc-interop" : "", hasMainEntry ? "" : "-parse-as-library", "-module-name", moduleName, "-emit-module", "-emit-module-path", modulePath.toString(), "-o", objectPath.toString(), "-emit-objc-header-path", headerPath.toString()); compilerCommand.addAll(compilerFlags); for (SourcePath sourcePath : srcs) { compilerCommand.add(resolver.getRelativePath(sourcePath).toString()); } ProjectFilesystem projectFilesystem = getProjectFilesystem(); return new SwiftCompileStep(projectFilesystem.getRootPath(), ImmutableMap.of(), compilerCommand.build()); }
From source file:com.android.build.gradle.internal.variant.ApkVariantOutputData.java
/** * Returns the list of {@link Supplier} for this variant. Some variant can produce more * than one file when dealing with pure splits. * @return the complete list of tasks producing an APK for this variant. *//*w ww .j a v a2 s . c om*/ public List<FileSupplier> getSplitOutputFileSuppliers() { ImmutableList.Builder<FileSupplier> tasks = ImmutableList.builder(); if (splitZipAlign != null || packageSplitResourcesTask != null) { tasks.addAll(splitZipAlign == null ? packageSplitResourcesTask.getOutputFileSuppliers() : splitZipAlign.getOutputFileSuppliers()); } // ABI splits zip are aligned together with the other densities in the splitZipAlign task // so only add the ABI splits from the package task if there was no splitZipAlign task. if (packageSplitAbiTask != null && splitZipAlign == null) { tasks.addAll(packageSplitAbiTask.getOutputFileSuppliers()); } return tasks.build(); }
From source file:org.lanternpowered.server.data.property.LanternPropertyRegistry.java
@SuppressWarnings("unchecked") public void completeRegistration() { this.allowRegistrations = false; for (Map.Entry<Class<? extends Property<?, ?>>, List<PropertyStore<?>>> entry : this.propertyStoreMap .entrySet()) {//from w w w .j a v a2s . co m final ImmutableList.Builder<PropertyStore<?>> propertyStoreBuilder = ImmutableList.builder(); Collections.sort(entry.getValue(), (o1, o2) -> Integer.compare(o2.getPriority(), o1.getPriority())); propertyStoreBuilder.addAll(entry.getValue()); this.delegateMap.put(entry.getKey(), new PropertyStoreDelegate(propertyStoreBuilder.build())); } this.propertyStoreMap.clear(); }
From source file:com.facebook.buck.android.GenerateStringResources.java
@Override public ImmutableList<? extends Step> getBuildSteps(BuildContext buildContext, BuildableContext buildableContext) { ImmutableList.Builder<Step> steps = ImmutableList.builder(); // Make sure we have a clean output directory Path outputDirPath = getPathForStringResourcesDirectory(); steps.addAll(MakeCleanDirectoryStep.of(BuildCellRelativePath .fromCellRelativePath(buildContext.getBuildCellRootPath(), getProjectFilesystem(), outputDirPath))); // Copy `values/strings.xml` files from resource directories to hex-enumerated resource // directories under output directory, retaining the input order steps.add(new AbstractExecutionStep("copy_string_resources") { @Override// ww w . j a v a2 s .co m public StepExecutionResult execute(ExecutionContext context) throws IOException { ProjectFilesystem fileSystem = getProjectFilesystem(); int i = 0; for (Path resDir : filteredResourcesProviders.stream() .flatMap(provider -> provider .getRelativeResDirectories(fileSystem, buildContext.getSourcePathResolver()) .stream()) .collect(ImmutableList.toImmutableList())) { Path stringsFilePath = resDir.resolve(VALUES).resolve(STRINGS_XML); if (fileSystem.exists(stringsFilePath)) { // create <output_dir>/<new_res_dir>/values Path newStringsFileDir = outputDirPath.resolve(String.format(NEW_RES_DIR_FORMAT, i++)) .resolve(VALUES); fileSystem.mkdirs(newStringsFileDir); // copy <res_dir>/values/strings.xml -> // <output_dir>/<new_res_dir>/values/strings.xml fileSystem.copyFile(stringsFilePath, newStringsFileDir.resolve(STRINGS_XML)); } } return StepExecutionResults.SUCCESS; } }); // Cache the outputDirPath with all the required string resources buildableContext.recordArtifact(outputDirPath); return steps.build(); }
From source file:com.facebook.buck.android.NdkBuildStep.java
@Override protected ImmutableList<String> getShellCommandInternal(ExecutionContext context) { Optional<Path> ndkRoot = context.getAndroidPlatformTarget().getNdkDirectory(); if (!ndkRoot.isPresent()) { throw new HumanReadableException("Must define a local.properties file" + " with a property named 'ndk.dir' that points to the absolute path of" + " your Android NDK directory, or set ANDROID_NDK."); }/* www .j ava 2s .c o m*/ ImmutableList.Builder<String> builder = ImmutableList.builder(); builder.add(ndkRoot.get().resolve("ndk-build").toAbsolutePath().toString(), "-j", Integer.toString(this.maxJobCount), "-C", this.makefileDirectory); builder.addAll(this.flags); ProjectFilesystem projectFilesystem = context.getProjectFilesystem(); Function<Path, Path> absolutifier = projectFilesystem.getAbsolutifier(); builder.add("APP_PROJECT_PATH=" + absolutifier.apply(buildArtifactsDirectory) + "/", "APP_BUILD_SCRIPT=" + absolutifier.apply(Paths.get(makefilePath)), "NDK_OUT=" + absolutifier.apply(buildArtifactsDirectory) + "/", "NDK_LIBS_OUT=" + projectFilesystem.resolve(binDirectory)); return builder.build(); }