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:com.zimbra.soap.admin.message.GetCertResponse.java

public void setCerts(Iterable<CertInfo> certs) {
    this.certs.clear();
    if (certs != null) {
        Iterables.addAll(this.certs, certs);
    }/*from ww w .j  a  va 2s.  c o m*/
}

From source file:org.apache.twill.internal.CompositeService.java

public CompositeService(Iterable<? extends Service> services) {
    this.services = new ArrayDeque<Service>();
    Iterables.addAll(this.services, services);
}

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

public void setInstances(Iterable<ExpandedRecurrenceInstance> instances) {
    this.instances.clear();
    if (instances != null) {
        Iterables.addAll(this.instances, instances);
    }/*from   w w  w.j  a va2  s .c o  m*/
}

From source file:com.zimbra.soap.admin.message.GetServerStatsResponse.java

public void setStats(Iterable<Stat> stats) {
    this.stats.clear();
    if (stats != null) {
        Iterables.addAll(this.stats, stats);
    }/*from ww w  .  jav a2  s. c om*/
}

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

public void setCsvFormats(Iterable<NamedElement> csvFormats) {
    this.csvFormats.clear();
    if (csvFormats != null) {
        Iterables.addAll(this.csvFormats, csvFormats);
    }//from   w  ww.  ja v a 2  s. c  o  m
}

From source file:org.apache.metron.common.writer.BulkWriterResponse.java

public void addAllSuccesses(Iterable<Tuple> allSuccesses) {
    if (allSuccesses != null) {
        Iterables.addAll(successes, allSuccesses);
    }
}

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

public void setFreebusyUsers(Iterable<FreeBusyUserInfo> freebusyUsers) {
    this.freebusyUsers.clear();
    if (freebusyUsers != null) {
        Iterables.addAll(this.freebusyUsers, freebusyUsers);
    }//w  w w  . j  av  a 2  s  .c  o m
}

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

public void setShares(Iterable<ShareNotificationInfo> shares) {
    this.shares.clear();
    if (shares != null) {
        Iterables.addAll(this.shares, shares);
    }/* w w  w  .j  a  v  a2 s  .c o  m*/
}

From source file:org.jclouds.vcloud.domain.ovf.VirtualHardwareSection.java

public VirtualHardwareSection(String info, System virtualSystem,
        Iterable<? extends ResourceAllocation> resourceAllocations) {
    this.info = info;
    this.virtualSystem = virtualSystem;
    Iterables.addAll(this.resourceAllocations, checkNotNull(resourceAllocations, "resourceAllocations"));
}

From source file:com.facebook.buck.graph.AbstractBottomUpTraversal.java

public final void traverse() {
    Iterables.addAll(nodesToExplore, graph.getNodesWithNoOutgoingEdges());
    while (!nodesToExplore.isEmpty()) {
        T node = nodesToExplore.remove();
        if (visitedNodes.contains(node)) {
            Preconditions.checkState(false,
                    "The queue of nodes to explore should not contain a node that has already been"
                            + " visited.");
        }/* www  . j av  a  2s. c  om*/

        visit(node);
        visitedNodes.add(node);

        // Only add a node to the set of nodes to be explored if all the nodes it depends on have
        // been visited already. We achieve the same by keeping track of the out degrees of explorable
        // nodes. After visiting a node, decrement the out degree of each of its parent node. When the
        // out degree reaches zero, it is safe to add that node to the list of nodes to explore next.
        for (T exploreCandidate : graph.getIncomingNodesFor(node)) {
            if (!effectiveOutDegreesOfExplorableNodes.containsKey(exploreCandidate)) {
                effectiveOutDegreesOfExplorableNodes.put(exploreCandidate,
                        new AtomicInteger(Iterables.size(graph.getOutgoingNodesFor(exploreCandidate))));
            }
            if (effectiveOutDegreesOfExplorableNodes.get(exploreCandidate).decrementAndGet() == 0) {
                nodesToExplore.add(exploreCandidate);
            }
        }
    }
}