List of usage examples for com.google.common.collect ImmutableList.Builder add
boolean add(E e);
From source file:net.morimekta.providence.generator.format.java.JavaEnumFormatter.java
private static List<EnumMemberFormatter> getFormatters(IndentedPrintWriter writer, JavaOptions options) { ImmutableList.Builder<EnumMemberFormatter> builder = ImmutableList.builder(); builder.add(new CommonMemberFormatter(writer)).add(new CoreMemberFormatter(writer)); if (options.jackson) { builder.add(new JacksonEnumFormatter(writer)); }/* w ww . j av a 2 s.c om*/ return builder.build(); }
From source file:org.sonar.java.JavaClasspathProperties.java
public static List<PropertyDefinition> getProperties() { ImmutableList.Builder<PropertyDefinition> extensions = ImmutableList.builder(); extensions.add(PropertyDefinition.builder(SONAR_JAVA_BINARIES).description( "Comma-separated paths to directories containing the binary files (directories with class files).") .hidden().build());/*from www. j a va 2 s .co m*/ extensions.add(PropertyDefinition.builder(SONAR_JAVA_LIBRARIES) .description("Comma-separated paths to libraries required by the project.").hidden().build()); extensions.add(PropertyDefinition.builder(SONAR_JAVA_TEST_BINARIES).description( "Comma-separated paths to directories containing the binary files (directories with class files).") .hidden().build()); extensions.add(PropertyDefinition.builder(SONAR_JAVA_TEST_LIBRARIES) .description("Comma-separated paths to libraries required by the project.").hidden().build()); return extensions.build(); }
From source file:gobblin.cluster.ContainerMetrics.java
private static List<Tag<?>> tagsForContainer(State containerState, String applicationName, String taskRunnerId) {/* w ww . java2s .c o m*/ ImmutableList.Builder<Tag<?>> tags = new ImmutableList.Builder<>(); tags.add(new Tag<>(GobblinClusterMetricTagNames.APPLICATION_NAME, applicationName)); tags.add(new Tag<>(GobblinClusterMetricTagNames.TASK_RUNNER_ID, taskRunnerId)); tags.addAll(getCustomTagsFromState(containerState)); return tags.build(); }
From source file:com.google.devtools.build.lib.rules.AliasProvider.java
public static AliasProvider fromAliasRule(Label label, ConfiguredTarget actual) { ImmutableList.Builder<Label> chain = ImmutableList.builder(); chain.add(label); AliasProvider dep = actual.getProvider(AliasProvider.class); if (dep != null) { chain.addAll(dep.getAliasChain()); }// w w w.ja v a2 s. c om return new AliasProvider(chain.build()); }
From source file:gobblin.yarn.ContainerMetrics.java
private static List<Tag<?>> tagsForContainer(State containerState, String applicationName, ContainerId containerId) {/*from w ww . j a v a2 s .c om*/ ImmutableList.Builder<Tag<?>> tags = new ImmutableList.Builder<>(); tags.add(new Tag<>(GobblinYarnMetricTagNames.YARN_APPLICATION_NAME, applicationName)); tags.add(new Tag<>(GobblinYarnMetricTagNames.YARN_APPLICATION_ID, containerId.getApplicationAttemptId().getApplicationId().toString())); tags.add(new Tag<>(GobblinYarnMetricTagNames.YARN_APPLICATION_ATTEMPT_ID, containerId.getApplicationAttemptId().toString())); tags.add(new Tag<>(GobblinYarnMetricTagNames.CONTAINER_ID, containerId.toString())); tags.addAll(getCustomTagsFromState(containerState)); return tags.build(); }
From source file:ru.adios.budgeter.util.Immutables.java
@SuppressWarnings("unchecked") public static <T> Collector<T, ImmutableList.Builder<T>, ImmutableList<T>> getListCollector() { return Collectors.of((Supplier<ImmutableList.Builder<T>>) LIST_BUILDER_SUPPLIER, new BiConsumer<ImmutableList.Builder<T>, T>() { @Override//ww w .j a v a 2s .c om public void accept(ImmutableList.Builder<T> b, T t) { b.add(t); } }, new BinaryOperator<ImmutableList.Builder<T>>() { @Override public ImmutableList.Builder<T> apply(ImmutableList.Builder<T> builder1, ImmutableList.Builder<T> builder2) { return builder1.addAll(builder2.build()); } }, new Function<ImmutableList.Builder<T>, ImmutableList<T>>() { @Override public ImmutableList<T> apply(ImmutableList.Builder<T> builder) { return builder.build(); } }); }
From source file:com.google.devtools.build.lib.skyframe.PostConfiguredTargetValue.java
public static ImmutableList<SkyKey> keys(Iterable<ConfiguredTargetKey> lacs) { ImmutableList.Builder<SkyKey> keys = ImmutableList.builder(); for (ConfiguredTargetKey lac : lacs) { keys.add(key(lac)); }/*from ww w .j a v a2s. c o m*/ return keys.build(); }
From source file:org.retrostore.util.DropdownValueForClient.java
public static List<DropdownValueForClient> from(Enum[] enums) { ImmutableList.Builder<DropdownValueForClient> builder = ImmutableList.builder(); for (Enum e : enums) { builder.add(from(e)); }/*from w ww.ja v a 2 s. co m*/ return builder.build(); }
From source file:io.crate.sql.tree.QueryUtil.java
public static Select selectList(Expression... expressions) { ImmutableList.Builder<SelectItem> items = ImmutableList.builder(); for (Expression expression : expressions) { items.add(new SingleColumn(expression)); }// www.j a v a2 s .c o m return new Select(false, items.build()); }
From source file:org.apache.james.javax.MultipartUtil.java
public static List<BodyPart> retrieveBodyParts(Multipart multipart) throws MessagingException { ImmutableList.Builder<BodyPart> builder = ImmutableList.builder(); for (int i = 0; i < multipart.getCount(); i++) { builder.add(multipart.getBodyPart(i)); }/*w w w . ja va 2s .co m*/ return builder.build(); }