Example usage for com.google.common.collect ImmutableList builder

List of usage examples for com.google.common.collect ImmutableList builder

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableList builder.

Prototype

public static <E> Builder<E> builder() 

Source Link

Usage

From source file:de.ii.ldproxy.output.html.ServiceOverviewView.java

public ServiceOverviewView(URI uri, Object data) {
    super("services", uri, data);
    this.title = "ldproxy Service Overview";
    this.description = "ldproxy Service Overview";
    this.keywords = new ImmutableList.Builder<String>().add("ldproxy", "service", "overview").build();
    this.breadCrumbs = new ImmutableList.Builder<NavigationDTO>().add(new NavigationDTO("Services", true))
            .build();/*from w w  w  .  java2  s. co  m*/
}

From source file:com.google.errorprone.bugpatterns.testdata.BadImportPositiveCases.java

public void variableDeclarationsNestedGenerics() {
    ImmutableList.Builder<ImmutableList.Builder<String>> builder1;
    ImmutableList.Builder<ImmutableList.Builder> builder1Raw;
    ImmutableList.Builder<ImmutableList.Builder<String>> builder2;
    ImmutableList.Builder<ImmutableList.Builder> builder2Raw;
}

From source file:org.obm.push.mail.BodyPreferencePolicyUtils.java

public static ImmutableList<BodyPreference> bodyPreferences(MSEmailBodyType... emailBodyTypes) {
    Builder<BodyPreference> preferences = ImmutableList.builder();
    for (MSEmailBodyType bodyType : emailBodyTypes) {
        preferences.add(bodyPreference(bodyType));
    }// ww w . j a v  a2  s . c om
    return preferences.build();
}

From source file:zookeeper.recipes.locks.InterProcessMultiLock.java

private static List<InterProcessLock> makeLocks(CuratorFramework client, List<String> paths) {
    ImmutableList.Builder<InterProcessLock> builder = ImmutableList.builder();
    for (String path : paths) {
        InterProcessLock lock = new InterProcessMutex(client, path);
        builder.add(lock);/*from   w  w w .  j  av a 2 s . c o m*/
    }
    return builder.build();
}

From source file:com.google.devtools.build.lib.rules.objc.CompiledResourceFile.java

/**
 * Given a sequence of artifacts corresponding to {@code .strings} files, returns a sequence of
 * the same length of instances of this class. The value returned by {@link #getBundled()} of each
 * instance will be the plist file in binary form.
 *//*from  w  w w.  java2s  . c om*/
public static Iterable<CompiledResourceFile> fromStringsFiles(IntermediateArtifacts intermediateArtifacts,
        Iterable<Artifact> strings) {
    ImmutableList.Builder<CompiledResourceFile> result = new ImmutableList.Builder<>();
    for (Artifact originalFile : strings) {
        Artifact binaryFile = intermediateArtifacts.convertedStringsFile(originalFile);
        result.add(new CompiledResourceFile(originalFile,
                new BundleableFile(binaryFile, BundleableFile.bundlePath(originalFile.getExecPath()))));
    }
    return result.build();
}

From source file:org.eclipse.buildship.ui.wizard.project.WelcomePageContentFactory.java

public static WelcomePageContent createCreationWizardWelcomePageContent() {
    Builder<PageParagraph> paragraphs = ImmutableList.builder();
    paragraphs//w  w  w . j a va  2  s. co  m
            .add(new PageParagraph(ProjectWizardMessages.Creation_Wizard_Paragraph_Title_Smart_Project_Creation,
                    ProjectWizardMessages.Creation_Wizard_Paragraph_Content_Smart_Project_Creation));
    paragraphs.add(new PageParagraph(ProjectWizardMessages.Creation_Wizard_Paragraph_Title_Gradle_Wrapper,
            ProjectWizardMessages.Creation_Wizard_Paragraph_Content_Gradle_Wrapper));
    paragraphs.add(new PageParagraph(ProjectWizardMessages.Creation_Wizard_Paragraph_Title_Advanced_Options,
            ProjectWizardMessages.Creation_Wizard_Paragraph_Content_Advanced_Options));

    return new WelcomePageContent(ProjectWizardMessages.Creation_Wizard_Welcome_Page_Name,
            ProjectWizardMessages.Title_GradleWelcomeWizardPage,
            ProjectWizardMessages.InfoMessage_NewGradleProjectWelcomeWizardPageDefault,
            ProjectWizardMessages.InfoMessage_NewGradleProjectWelcomeWizardPageContext,
            ProjectWizardMessages.Creation_Wizard_Paragraph_Main_Title, paragraphs.build());
}

From source file:com.facebook.presto.type.FunctionType.java

private static TypeSignature[] typeParameters(List<Type> argumentTypes, Type returnType) {
    requireNonNull(returnType, "returnType is null");
    requireNonNull(argumentTypes, "argumentTypes is null");
    ImmutableList.Builder<TypeSignature> builder = ImmutableList.builder();
    argumentTypes.stream().map(Type::getTypeSignature).forEach(builder::add);
    builder.add(returnType.getTypeSignature());
    List<TypeSignature> signatures = builder.build();
    return signatures.toArray(new TypeSignature[signatures.size()]);
}

From source file:com.spectralogic.ds3autogen.java.utils.CommonRequestGeneratorUtils.java

/**
 * Creates a constructor with the provided parameters in addition to
 * adding the required parameter Stream for parsing a request payload.
 *//*from w ww.j  a  v a 2s. com*/
public static RequestConstructor createInputStreamConstructor(final ImmutableList<Arguments> parameters,
        final ImmutableList<QueryParam> queryParams, final String requestName, final Ds3DocSpec docSpec) {
    final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
    if (hasContent(parameters)) {
        builder.addAll(parameters);
    }
    builder.add(new Arguments("InputStream", "Stream"));

    final ImmutableList<Arguments> updatedParameters = builder.build();
    final ImmutableList<String> argNames = updatedParameters.stream().map(Arguments::getName)
            .collect(GuavaCollectors.immutableList());

    return new RequestConstructor(updatedParameters, updatedParameters, queryParams,
            toConstructorDocs(requestName, argNames, docSpec, 1));
}

From source file:com.facebook.buck.cxx.AbstractNativeLinkableInput.java

/**
 * Combine, in order, several {@link NativeLinkableInput} objects into a single one.
 *///w w  w  .j  av a  2s.co  m
public static NativeLinkableInput concat(Iterable<NativeLinkableInput> items) {
    ImmutableList.Builder<Arg> args = ImmutableList.builder();
    ImmutableSet.Builder<FrameworkPath> frameworks = ImmutableSet.builder();
    ImmutableSet.Builder<FrameworkPath> libraries = ImmutableSet.builder();

    for (NativeLinkableInput item : items) {
        args.addAll(item.getArgs());
        frameworks.addAll(item.getFrameworks());
        libraries.addAll(item.getLibraries());
    }

    return NativeLinkableInput.of(args.build(), frameworks.build(), libraries.build());
}

From source file:org.terasology.util.Varargs.java

/**
 * Combines a single value and array into an immutable list.
 * This is intended to aid methods using the mandatory-first optional-additional varargs trick.
 *
 * @param first      The first, single value
 * @param additional Any additional values
 * @param <T>        The type of the items
 * @return A set of the combined values/*from w  w w.  j av a2 s.  c o  m*/
 */
@SafeVarargs
public static <T> ImmutableList<T> combineToList(T first, T... additional) {
    ImmutableList.Builder<T> builder = ImmutableList.builder();
    builder.add(first);
    builder.addAll(Arrays.asList(additional));
    return builder.build();
}