Example usage for com.google.common.collect Iterables addAll

List of usage examples for com.google.common.collect Iterables addAll

Introduction

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

Prototype

public static <T> boolean addAll(Collection<T> addTo, Iterable<? extends T> elementsToAdd) 

Source Link

Document

Adds all elements in iterable to collection .

Usage

From source file:org.eclipse.sirius.diagram.ui.tools.internal.actions.repair.AbstractAbstractDNodeDiagramElementState.java

/**
 * {@inheritDoc}/*from w  ww  . j a  v  a  2  s. co  m*/
 * 
 * @see org.eclipse.sirius.diagram.tools.internal.actions.repair.AbstractDiagramElementState#storeElementState(EObject,
 *      DiagramElementMapping, org.eclipse.sirius.diagram.DDiagramElement)
 */
@Override
public void storeElementState(EObject target, DiagramElementMapping mapping, D element) {
    super.storeElementState(target, mapping, element);

    Iterable<ArrangeConstraint> existingArrangeConstraints = Iterables.filter(element.getArrangeConstraints(),
            ArrangeConstraint.class);
    if (!Iterables.isEmpty(existingArrangeConstraints)) {
        Iterables.addAll(arrangeConstraints, existingArrangeConstraints);
    }
}

From source file:com.zimbra.soap.admin.type.VersionCheckInfo.java

public void setUpdates(Iterable<VersionCheckUpdateInfo> updates) {
    this.updates.clear();
    if (updates != null) {
        Iterables.addAll(this.updates, updates);
    }//from ww w.ja va  2s .c o m
}

From source file:com.qnoid.java.tRcn.Grinder.java

/**
 * Grinds the items specified in {@link #Grinder(Iterable)} and returns a
 * new Grinder holding the <O> for further grinding.
 * //from w  w  w .ja  va2  s .  c om
 * @param <O> what the grinding produces with the specified blade
 * @param blade the blade to use for the grinding
 * @return a new Grinder instance to chain the 
 * @see #items to get the result of the grinding 
 */
public <O> Grinder<O> grind(Blade<T, O> blade) {
    List<O> output = Lists.newArrayList();

    for (T value : this.items) {
        Iterable<O> cut = blade.cut(value);
        Iterables.addAll(output, cut);
    }

    return new Grinder<O>(output);
}

From source file:com.zimbra.soap.account.message.GetWhiteBlackListResponse.java

public void setWhiteListEntries(Iterable<String> whiteListEntries) {
    this.whiteListEntries.clear();
    if (whiteListEntries != null) {
        Iterables.addAll(this.whiteListEntries, whiteListEntries);
    }/*ww  w  .  j a  v a  2  s  .c  o  m*/
}

From source file:co.cask.tigon.data.transaction.queue.AbstractQueueProducer.java

@Override
public void enqueue(Iterable<QueueEntry> entries) throws IOException {
    Preconditions.checkState(transaction != null, "Enqueue called outside of transaction.");
    Iterables.addAll(queue, entries);
}

From source file:com.zimbra.soap.mail.message.ModifyFilterRulesRequest.java

/**
 * Add additional filter rules//  w w  w  . ja v a 2  s  .c om
 */
public void addFilterRules(Iterable<FilterRule> filterRules) {
    if (filterRules != null) {
        Iterables.addAll(this.filterRules, filterRules);
    }
}

From source file:org.cloudsmith.geppetto.pp.dsl.adapters.CrossReferenceAdapter.java

public void set(Iterable<IEObjectDescription> descriptions) {
    List<IEObjectDescription> result = Lists.newArrayList();
    Iterables.addAll(result, descriptions);
    referenced = Collections.unmodifiableList(result);
}

From source file:org.eclipse.sirius.ui.tools.internal.views.modelexplorer.DeleteActionHandler.java

private Collection<DRepresentation> getRepresentations() {
    ISelection selection = selectionProvider.getSelection();
    if (selection instanceof IStructuredSelection) {
        Collection<?> selections = ((IStructuredSelection) selection).toList();
        if (selections != null && !selections.isEmpty()) {
            Collection<DRepresentation> selectedRepresentations = Sets.newLinkedHashSet();
            Iterables.addAll(selectedRepresentations, Iterables.filter(selections, DRepresentation.class));
            Iterables.addAll(selectedRepresentations,
                    Iterables.transform(Iterables.filter(selections, RepresentationItemImpl.class),
                            RepresentationItemImpl.REPRESENTATION_ITEM_TO_REPRESENTATION));
            return selectedRepresentations;
        }//from   www  . jav a  2  s . c  o m
    }
    return Collections.emptyList();
}

From source file:org.renjin.sexp.ListVector.java

public ListVector(Iterable<? extends SEXP> values, AttributeMap attributes) {
    super(Null.INSTANCE, attributes);
    this.values = new ArrayList<SEXP>();
    Iterables.addAll(this.values, values);
}

From source file:org.jclouds.vcloud.domain.internal.VAppImpl.java

public VAppImpl(String name, String type, URI id, Status status, ReferenceType vdc,
        @Nullable String description, Iterable<Task> tasks, boolean ovfDescriptorUploaded,
        Iterable<Vm> children, @Nullable VCloudNetworkSection networkSection) {
    super(name, type, id);
    this.status = checkNotNull(status, "status");
    this.vdc = vdc;// TODO: once <1.0 is killed check not null
    this.description = description;
    Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
    this.ovfDescriptorUploaded = ovfDescriptorUploaded;
    Iterables.addAll(this.children, checkNotNull(children, "children"));
    this.networkSection = networkSection; // can be null when copying
}