Example usage for com.google.common.collect ImmutableList.Builder addAll

List of usage examples for com.google.common.collect ImmutableList.Builder addAll

Introduction

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

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).

Usage

From source file:org.apache.james.transport.mailets.remote.delivery.DelaysAndMaxRetry.java

/**
 * <p>/*  w  ww.  j  ava  2 s  .  c  om*/
 * This method expands an ArrayList containing Delay objects into an array
 * holding the only delaytime in the order.
 * </p>
 * <p/>
 * So if the list has 2 Delay objects the first having attempts=2 and
 * delaytime 4000 the second having attempts=1 and delaytime=300000 will be
 * expanded into this array:
 * <p/>
 * <pre>
 * long[0] = 4000
 * long[1] = 4000
 * long[2] = 300000
 * </pre>
 *
 * @param list the list to expand
 * @return the expanded list
 */
public List<Long> getExpandedDelays() {
    ImmutableList.Builder<Long> builder = ImmutableList.builder();
    for (Delay delay : delays) {
        builder.addAll(delay.getExpendendDelays());
    }
    return builder.build();
}

From source file:com.facebook.presto.sql.tree.FunctionCall.java

@Override
public List<Node> getChildren() {
    ImmutableList.Builder<Node> nodes = ImmutableList.builder();
    window.ifPresent(nodes::add);/*from w  w w.  j a v a 2  s .  c o m*/
    filter.ifPresent(nodes::add);
    nodes.addAll(arguments);
    return nodes.build();
}

From source file:org.apache.abdera2.common.protocol.AbstractMessage.java

public Iterable<WebLink> getWebLinks() {
    ImmutableList.Builder<WebLink> links = ImmutableList.builder();
    Iterable<Object> headers = this.getHeaders("Link");
    for (Object obj : headers)
        links.addAll(WebLink.parse(obj.toString()));
    return links.build();
}

From source file:co.cask.cdap.data.view.MDSViewStore.java

@Override
public List<Id.Stream.View> list(final Id.Stream streamId) {
    List<StreamViewEntry> entries = execute(
            new TransactionExecutor.Function<ViewMetadataStoreDataset, List<StreamViewEntry>>() {
                @Override//  ww  w .j  av  a 2 s .  com
                public List<StreamViewEntry> apply(ViewMetadataStoreDataset mds) throws Exception {
                    return Objects.firstNonNull(
                            mds.<StreamViewEntry>list(getKey(streamId), StreamViewEntry.class),
                            ImmutableList.<StreamViewEntry>of());
                }
            });

    ImmutableList.Builder<Id.Stream.View> builder = ImmutableList.builder();
    builder.addAll(Collections2.transform(entries, new Function<StreamViewEntry, Id.Stream.View>() {
        @Override
        public Id.Stream.View apply(StreamViewEntry input) {
            return input.getId();
        }
    }));
    return builder.build();
}

From source file:is.illuminati.block.spyros.garmin.model.Lap.java

/**
 * Get all track points in the lap//w  ww.  j  a  v a 2  s  . com
 * @return list of all track points.
 */
public ImmutableList<TrackPoint> getTrackPoints() {
    ImmutableList.Builder<TrackPoint> builder = ImmutableList.builder();
    for (Track track : tracks) {
        builder.addAll(track.getTrackPoints());
    }
    return builder.build();
}

From source file:org.apache.james.transport.mailets.remoteDelivery.DelaysAndMaxRetry.java

/**
 * <p>/*from   w w w. j av  a  2  s  .c  o m*/
 * This method expands an ArrayList containing Delay objects into an array
 * holding the only delaytime in the order.
 * </p>
 * <p/>
 * So if the list has 2 Delay objects the first having attempts=2 and
 * delaytime 4000 the second having attempts=1 and delaytime=300000 will be
 * expanded into this array:
 * <p/>
 * <pre>
 * long[0] = 4000
 * long[1] = 4000
 * long[2] = 300000
 * </pre>
 *
 * @param list the list to expand
 * @return the expanded list
 */
public List<Long> getExpendedDelays() {
    ImmutableList.Builder<Long> builder = ImmutableList.builder();
    for (Delay delay : delays) {
        builder.addAll(delay.getExpendendDelays());
    }
    return builder.build();
}

From source file:org.apache.abdera2.common.protocol.AbstractMessage.java

public Iterable<Preference> getPrefer() {
    ImmutableList.Builder<Preference> links = ImmutableList.builder();
    Iterable<Object> headers = this.getHeaders("Prefer");
    for (Object obj : headers)
        links.addAll(Preference.parse(obj.toString()));
    return links.build();
}

From source file:com.android.tools.idea.welcome.install.ComponentCategory.java

@NotNull
@Override/*from  w ww  .j a  v a  2s .  co  m*/
public Collection<DynamicWizardStep> createSteps() {
    ImmutableList.Builder<DynamicWizardStep> builder = ImmutableList.builder();
    for (ComponentTreeNode component : myComponents) {
        builder.addAll(component.createSteps());
    }
    return builder.build();
}

From source file:io.soabase.core.features.attributes.StandardAttributesContainer.java

public StandardAttributesContainer(List<String> scopes) {
    scopes = Preconditions.checkNotNull(scopes, "scopes cannot be null");
    ImmutableList.Builder<String> builder = ImmutableList.builder();
    builder.addAll(scopes);
    builder.add(DEFAULT_SCOPE);//w w w  . ja  v a2s  . co  m
    this.scopes = builder.build();
}

From source file:org.zanata.client.commands.push.AbstractPushStrategy.java

private ImmutableList<String> getFullExcludes(ImmutableList<String> excludes, boolean excludeLocaleFilenames) {
    if (excludeLocaleFilenames) {
        ImmutableList.Builder<String> builder = ImmutableList.builder();
        // excludes may not be mutable, so make a copy
        builder.addAll(excludes);
        builder.addAll(getExcludesForLocaleFilenames());
        return builder.build();
    } else {//from  www .j  a  v  a  2s  .  c o m
        return excludes;
    }
}