List of usage examples for com.google.common.collect ImmutableList.Builder add
boolean add(E e);
From source file:org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.java
public static TreeComplexUsesAugment complexUsesAugment(final ListViaUsesKey... keys) { ImmutableList.Builder<ListViaUses> listViaUses = ImmutableList.<ListViaUses>builder(); for (ListViaUsesKey key : keys) { listViaUses.add(new ListViaUsesBuilder().setKey(key).build()); }/*www.j av a 2 s .c o m*/ return new TreeComplexUsesAugmentBuilder().setListViaUses(listViaUses.build()).build(); }
From source file:rx.transformer.GuavaTransformers.java
/** * Returns a Transformer<T,ImmutableList<T>> that maps an Observable<T> to an Observable<ImmutableList<T>> *//*from w w w . j a v a 2 s . c o m*/ public static <T> Observable.Transformer<T, ImmutableList<T>> toImmutableList() { return new Observable.Transformer<T, ImmutableList<T>>() { @Override public Observable<ImmutableList<T>> call(Observable<T> source) { return source.collect(new Func0<ImmutableList.Builder<T>>() { @Override public ImmutableList.Builder<T> call() { return ImmutableList.builder(); } }, new Action2<ImmutableList.Builder<T>, T>() { @Override public void call(ImmutableList.Builder<T> builder, T t) { builder.add(t); } }).map(new Func1<ImmutableList.Builder<T>, ImmutableList<T>>() { @Override public ImmutableList<T> call(ImmutableList.Builder<T> builder) { return builder.build(); } }); } }; }
From source file:com.squareup.wire.schema.EnumConstant.java
static ImmutableList<EnumConstant> fromElements(ImmutableList<EnumConstantElement> elements) { ImmutableList.Builder<EnumConstant> constants = ImmutableList.builder(); for (EnumConstantElement element : elements) { constants.add(fromElement(element)); }//from www .java2s . c o m return constants.build(); }
From source file:org.waveprotocol.wave.model.raw.RawFragmentFactory.java
private static ImmutableList<RawOperation> toRawOperations(List<SegmentOperation> operations) { ImmutableList.Builder<RawOperation> rawOperations = ImmutableList.builder(); for (SegmentOperation segmentOperation : operations) { rawOperations.add(segmentOperation.getRawOperation()); }// w w w . j a v a2 s . c om return rawOperations.build(); }
From source file:com.sos.scheduler.engine.kernel.event.SimpleMessage.java
private static ImmutableList<String> listOfInsertions(Object[] insertions) { ImmutableList.Builder<String> result = new ImmutableList.Builder<String>(); //insertions.length); for (Object o : insertions) result.add(failsafeToString(o)); return result.build(); }
From source file:com.squareup.wire.schema.Rpc.java
static ImmutableList<RpcElement> toElements(ImmutableList<Rpc> rpcs) { ImmutableList.Builder<RpcElement> elements = new ImmutableList.Builder<>(); for (Rpc rpc : rpcs) { elements.add(RpcElement.builder(rpc.location).documentation(rpc.documentation).name(rpc.name) .requestType(rpc.requestTypeElement).responseType(rpc.responseTypeElement) .options(rpc.options.toElements()).build()); }/* w w w .j a va 2 s .c o m*/ return elements.build(); }
From source file:eu.arthepsy.sonar.plugins.rebrand.RebrandConfiguration.java
public static List<PropertyDefinition> getPropertyDefinitions() { ImmutableList.Builder<PropertyDefinition> properties = ImmutableList.builder(); final String generalCategory = "#General"; properties.add( PropertyDefinition.builder(ORIGINAL_LOGO_VISIBLE).category(CATEGORY).subCategory(generalCategory) .index(0).name("SonarQube logo").description("Visibility of SonarQube logo") .type(PropertyType.BOOLEAN).defaultValue("true").build()); properties.add(/*from w ww . ja va 2 s . c o m*/ PropertyDefinition.builder(ORIGINAL_FOOTER_VISIBLE).category(CATEGORY).subCategory(generalCategory) .index(0).name("SonarQube footer").description("Visibility of SonarQube footer") .type(PropertyType.BOOLEAN).defaultValue("true").build()); properties.addAll(getImagePropertyDefinitions(SIDEBAR_PREFIX, "Sidebar")); properties.addAll(getImagePropertyDefinitions(CONTENT_PREFIX, "Content")); return properties.build(); }
From source file:com.facebook.buck.rules.args.SourcePathArg.java
public static ImmutableList<Arg> from(SourcePathResolver pathResolver, Iterable<SourcePath> paths) { ImmutableList.Builder<Arg> converted = ImmutableList.builder(); for (SourcePath path : paths) { converted.add(new SourcePathArg(pathResolver, path)); }/*from ww w. j a v a 2 s.c om*/ return converted.build(); }
From source file:com.squareup.wire.schema.Extend.java
static ImmutableList<Extend> fromElements(String packageName, ImmutableList<ExtendElement> extendElements) { ImmutableList.Builder<Extend> extendBuilder = new ImmutableList.Builder<>(); for (ExtendElement extendElement : extendElements) { extendBuilder.add(new Extend(extendElement.location(), extendElement.documentation(), extendElement.name(), Field.fromElements(packageName, extendElement.fields(), true))); }// w ww.j av a 2 s. co m return extendBuilder.build(); }
From source file:aeon.compiler.context.SqliteContext.java
/** * Creates a {@link aeon.compiler.context.SqliteContext} from an instance of {@link aeon.compiler.context.Context}. * * @param context Source Context for building SqliteContext * @return SqliteContext build from Context *//*from ww w .j a va2s . c om*/ @NotNull public static SqliteContext of(@NotNull final Context context) { checkNotNull(context); final SqliteEntityName targetClassName = SqliteEntityName .fromName(context.getTargetClassName().simpleName()); final ImmutableList.Builder<SqliteField> builder = ImmutableList.builder(); for (final Field field : context.getFieldContext().getFields()) { builder.add(SqliteField.of(field)); } return new SqliteContext(targetClassName, builder.build()); }