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.jclouds.atmosonline.saas.domain.internal.BoundedTreeSet.java

public BoundedTreeSet(Iterable<T> contents, String token) {
    Iterables.addAll(this, contents);
    this.token = token;
}

From source file:com.lastcalc.engines.RecentFirstParserPickerFactory.java

public RecentFirstParserPickerFactory(final Iterable<Parser> parsers, final int maxParsers) {
    this.maxParsers = maxParsers;
    Iterables.addAll(this.parsers, parsers);
    while (this.parsers.size() > maxParsers) {
        this.parsers.removeLast();
    }//from ww w . java  2s . c  om
}

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

public void setZimlets(Iterable<ZimletStatus> zimlets) {
    this.zimlets.clear();
    if (zimlets != null) {
        Iterables.addAll(this.zimlets, zimlets);
    }/*from   w  w w  .j a v  a2s  . c  o  m*/
}

From source file:org.janusgraph.util.datastructures.PointInterval.java

public PointInterval(Iterable<T> points) {
    this.points = new HashSet<T>(4);
    Iterables.addAll(this.points, points);
}

From source file:edu.buaa.satla.analysis.cfa.CFACheck.java

/**
 * Traverse the CFA and run a series of checks at each node
 * @param cfa Node to start traversal from
 * @param nodes Optional set of all nodes in the CFA (may be null)
 * @param pruned Whether the CFA was pruned and may be incomplete.
 */// w  w  w.  j a  v a2s.c om
public static boolean check(FunctionEntryNode cfa, Collection<CFANode> nodes, boolean pruned) {

    Set<CFANode> visitedNodes = new HashSet<>();
    Deque<CFANode> waitingNodeList = new ArrayDeque<>();

    waitingNodeList.add(cfa);
    while (!waitingNodeList.isEmpty()) {
        CFANode node = waitingNodeList.poll();

        if (visitedNodes.add(node)) {
            Iterables.addAll(waitingNodeList, CFAUtils.successorsOf(node));
            Iterables.addAll(waitingNodeList, CFAUtils.predecessorsOf(node)); // just to be sure to get ALL nodes.

            // The actual checks
            isConsistent(node);
            checkEdgeCount(node, pruned);
        }
    }

    if (nodes != null) {
        if (!visitedNodes.equals(nodes)) {
            assert false : "\nNodes in CFA but not reachable through traversal: "
                    + Iterables.transform(Sets.difference(new HashSet<>(nodes), visitedNodes), DEBUG_FORMAT)
                    + "\nNodes reached that are not in CFA: "
                    + Iterables.transform(Sets.difference(visitedNodes, new HashSet<>(nodes)), DEBUG_FORMAT);
        }
    }
    return true;
}

From source file:org.jclouds.blobstore.domain.internal.ListResponseImpl.java

public ListResponseImpl(Iterable<T> contents, String marker, Integer maxResults, boolean isTruncated) {
    Iterables.addAll(this, contents);
    this.marker = marker;
    this.maxResults = maxResults;
    this.truncated = isTruncated;
}

From source file:com.linkedin.bowser.core.functions.List.java

@Override
public NQLObject apply(Map<String, NQLObject> globals, java.util.List<NQLObject> arguments) {
    assertNumberOfArguments(arguments, 1);
    Collection c = getAsCollection(arguments.get(0));

    java.util.List<NQLObject> list = new ArrayList<NQLObject>();
    Iterables.addAll(list, c);

    return new ListObject(list);
}

From source file:org.jclouds.ibmdev.domain.Key.java

public Key(boolean isDefault, Iterable<String> instanceIds, String keyMaterial, String name,
        Date lastModifiedTime) {/*from ww w  . j  a  va  2s  .co m*/
    this.isDefault = isDefault;
    Iterables.addAll(this.instanceIds, instanceIds);
    this.keyMaterial = keyMaterial;
    this.name = name;
    this.lastModifiedTime = lastModifiedTime;
}

From source file:org.eclipse.sirius.diagram.sequence.business.internal.layout.flag.SequenceDiagramAbsoluteBoundsFlagger.java

/**
 * {@inheritDoc}//ww  w  .j  a  v a2 s  . c  o m
 */
@Override
protected Collection<ISequenceElement> getEventsToFlag() {
    List<ISequenceElement> eventsToFlag = Lists.newArrayList();
    if (diagram != null) {
        Iterables.addAll(eventsToFlag, diagram.getAllDelimitedSequenceEvents());
        Iterables.addAll(eventsToFlag, diagram.getAllLostMessageEnds());
        Iterables.addAll(eventsToFlag, diagram.getAllInstanceRoles());
    }
    return eventsToFlag;
}

From source file:com.zimbra.soap.voice.type.RootVoiceFolder.java

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