List of usage examples for com.google.common.collect ImmutableList.Builder addAll
boolean addAll(Collection<? extends E> c);
From source file:com.dteoh.tidal.views.models.DropletModel.java
/** * Creates a new droplet view model.//from w ww. ja va 2s . co m * * @param dropletName * Name of the droplet. * @param dropletContents * Contents of the view model. */ public DropletModel(final ID identifier, final String dropletName, final RippleModel... dropletContents) { dropletID = identifier; this.dropletName = dropletName; final List<RippleModel> models = new ArrayList<RippleModel>(); for (final RippleModel model : dropletContents) { models.add(model); } Collections.sort(models); final ImmutableList.Builder<RippleModel> modelBuilder = ImmutableList.builder(); modelBuilder.addAll(models); this.dropletContents = modelBuilder.build(); }
From source file:com.dteoh.tidal.views.models.DropletModel.java
/** * Creates a new droplet view model./*w w w. j av a2 s .c om*/ * * @param dropletName * Name of the droplet. * @param dropletContents * Contents of the view model. */ public DropletModel(final ID identifier, final String dropletName, final Iterable<RippleModel> dropletContents) { dropletID = identifier; this.dropletName = dropletName; final List<RippleModel> models = new ArrayList<RippleModel>(); for (final RippleModel model : dropletContents) { models.add(model); } Collections.sort(models); final ImmutableList.Builder<RippleModel> modelBuilder = ImmutableList.builder(); modelBuilder.addAll(models); this.dropletContents = modelBuilder.build(); }
From source file:com.facebook.buck.features.halide.HalideCompile.java
@Override public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) { Path outputDir = context.getSourcePathResolver().getRelativePath(getSourcePathToOutput()); buildableContext//from ww w . j av a2s. c om .recordArtifact(objectOutputPath(getBuildTarget(), getProjectFilesystem(), functionNameOverride)); buildableContext .recordArtifact(headerOutputPath(getBuildTarget(), getProjectFilesystem(), functionNameOverride)); ImmutableList.Builder<Step> commands = ImmutableList.builder(); ProjectFilesystem projectFilesystem = getProjectFilesystem(); commands.addAll(MakeCleanDirectoryStep.of(BuildCellRelativePath .fromCellRelativePath(context.getBuildCellRootPath(), getProjectFilesystem(), outputDir))); commands.add(new HalideCompilerStep(projectFilesystem.getRootPath(), halideCompiler.getEnvironment(context.getSourcePathResolver()), halideCompiler.getCommandPrefix(context.getSourcePathResolver()), outputDir, fileOutputName(getBuildTarget(), functionNameOverride), targetPlatform, compilerInvocationFlags)); return commands.build(); }
From source file:com.google.api.codegen.transformer.nodejs.NodeJSApiMethodParamTransformer.java
@Override public List<DynamicLangDefaultableParamView> generateMethodParams(GapicMethodContext context) { ImmutableList.Builder<DynamicLangDefaultableParamView> methodParams = ImmutableList.builder(); methodParams.addAll(generateDefaultableParams(context)); DynamicLangDefaultableParamView.Builder optionsParam = DynamicLangDefaultableParamView.newBuilder(); optionsParam.name("options"); optionsParam.defaultValue("null"); methodParams.add(optionsParam.build()); return methodParams.build(); }
From source file:com.facebook.presto.bytecode.expression.InvokeBytecodeExpression.java
@Override public List<BytecodeNode> getChildNodes() { ImmutableList.Builder<BytecodeNode> children = ImmutableList.builder(); if (instance != null) { children.add(instance);/* w w w . j a va 2 s . c om*/ } children.addAll(parameters); return children.build(); }
From source file:com.google.api.codegen.transformer.php.PhpApiMethodParamTransformer.java
@Override public List<ParamDocView> generateParamDocs(GapicMethodContext context) { ImmutableList.Builder<ParamDocView> paramDocs = ImmutableList.builder(); paramDocs.addAll(getMethodParamDocs(context, context.getMethodConfig().getRequiredFields())); paramDocs.add(getOptionalArrayParamDoc(context, context.getMethodConfig().getOptionalFields())); return paramDocs.build(); }
From source file:org.apache.calcite.sql.validate.TableNamespace.java
/** Creates a TableNamespace based on the same table as this one, but with * extended fields./*w w w .java 2s . c o m*/ * * <p>Extended fields are "hidden" or undeclared fields that may nevertheless * be present if you ask for them. Phoenix uses them, for instance, to access * rarely used fields in the underlying HBase table. */ public TableNamespace extend(SqlNodeList extendList) { final List<SqlNode> identifierList = Util.quotientList(extendList.getList(), 2, 0); SqlValidatorUtil.checkIdentifierListForDuplicates(identifierList, validator.getValidationErrorFunction()); final ImmutableList.Builder<RelDataTypeField> builder = ImmutableList.builder(); builder.addAll(this.extendedFields); builder.addAll(SqlValidatorUtil.getExtendedColumns(validator.getTypeFactory(), getTable(), extendList)); final List<RelDataTypeField> extendedFields = builder.build(); final Table schemaTable = table.unwrap(Table.class); if (schemaTable != null && table instanceof RelOptTable && (schemaTable instanceof ExtensibleTable || schemaTable instanceof ModifiableViewTable)) { checkExtendedColumnTypes(extendList); final RelOptTable relOptTable = ((RelOptTable) table).extend(extendedFields); final SqlValidatorTable validatorTable = relOptTable.unwrap(SqlValidatorTable.class); return new TableNamespace(validator, validatorTable, ImmutableList.<RelDataTypeField>of()); } return new TableNamespace(validator, table, extendedFields); }
From source file:com.facebook.buck.haskell.HaskellBuckConfig.java
private Optional<ImmutableList<String>> getFlags(String field) { Optional<String> value = delegate.getValue(SECTION, field); if (!value.isPresent()) { return Optional.empty(); }//from w w w . j a v a2 s .c o m ImmutableList.Builder<String> split = ImmutableList.builder(); if (!value.get().trim().isEmpty()) { split.addAll(Splitter.on(" ").split(value.get().trim())); } return Optional.of(split.build()); }
From source file:org.sosy_lab.cpachecker.cpa.overflow.OverflowCPA.java
@Override public Collection<? extends AbstractState> getAbstractSuccessorsForEdge(AbstractState state, Precision precision, CFAEdge cfaEdge) throws CPATransferException, InterruptedException { OverflowState prev = (OverflowState) state; if (prev.hasOverflow()) { // Once we have an overflow there is no need to continue. return Collections.emptyList(); }//w w w. j a va 2s. co m List<CExpression> assumptions = noOverflowAssumptionBuilder.assumptionsForEdge(cfaEdge); if (assumptions.isEmpty()) { return ImmutableList.of(new OverflowState(ImmutableList.of(), false)); } // No overflows <=> all assumptions hold. List<? extends AExpression> noOverflows; if (assumptions.isEmpty()) { noOverflows = Collections.emptyList(); } else { noOverflows = assumptions; } ImmutableList.Builder<OverflowState> outStates = ImmutableList.builder(); outStates.addAll(Lists.transform(assumptions, // Overflow <=> there exists a violating assumption. a -> new OverflowState(ImmutableList.of(mkNot(a)), true))); outStates.add(new OverflowState(noOverflows, false)); return outStates.build(); }
From source file:io.prestosql.execution.executor.TaskHandle.java
public synchronized List<PrioritizedSplitRunner> destroy() { destroyed = true;/* www .ja v a2s.com*/ ImmutableList.Builder<PrioritizedSplitRunner> builder = ImmutableList.builder(); builder.addAll(runningIntermediateSplits); builder.addAll(runningLeafSplits); builder.addAll(queuedLeafSplits); runningIntermediateSplits.clear(); runningLeafSplits.clear(); queuedLeafSplits.clear(); return builder.build(); }