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.metaborg.intellij.idea.extensions.IntelliJPluginLoader.java

@Override
public Collection<Module> modules() throws MetaborgException {
    try {/*  w ww .  j  av a2 s  .co  m*/
        final Iterable<T> plugins = getPlugins();
        final Collection<Module> modules = Lists.newLinkedList();
        for (final T plugin : plugins) {
            Iterables.addAll(modules, plugin.modules());
        }
        return modules;
    } catch (final Exception e) {
        throw new MetaborgException(
                "Unhandled exception while loading module plugins with IntelliJ's IntelliJPluginLoader.", e);
    }
}

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

public AbstractBreadthFirstTraversal(Iterable<? extends Node> initialNodes) {
    toExplore = Lists.newLinkedList();//ww  w.j  a v a2 s.c o m
    Iterables.addAll(toExplore, initialNodes);
    explored = Sets.newHashSet();
}

From source file:vogar.android.AppProcessMode.java

@Override
public VmCommandBuilder newVmCommandBuilder(Action action, File workingDirectory) {
    List<String> vmCommand = new ArrayList<String>();
    vmCommand.addAll(run.target.targetProcessPrefix(workingDirectory));
    vmCommand.add(run.getAndroidData());
    Iterables.addAll(vmCommand, run.invokeWith());
    vmCommand.add("app_process");

    return new VmCommandBuilder(run.log).vmCommand(vmCommand).vmArgs(action.getUserDir().getPath())
            .classpathViaProperty(true).maxLength(1024);
}

From source file:org.jclouds.atmos.domain.internal.BoundedLinkedHashSet.java

public BoundedLinkedHashSet(Iterable<T> contents, @Nullable String token) {
    Iterables.addAll(this, checkNotNull(contents, "contents"));
    this.token = token;
}

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

public NetworkSection(String info, Iterable<Network> networks) {
    this.info = info;
    Iterables.addAll(this.networks, networks);
}

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

public AbstractBreadthFirstThrowingTraversal(Iterable<? extends Node> initialNodes) {
    toExplore = Lists.newLinkedList();//w  w w.  j  a v  a  2  s  .com
    Iterables.addAll(toExplore, initialNodes);
    explored = Sets.newHashSet();
}

From source file:vogar.JavaVm.java

@Override
public VmCommandBuilder newVmCommandBuilder(Action action, File workingDirectory) {
    List<String> vmCommand = new ArrayList<String>();
    Iterables.addAll(vmCommand, run.invokeWith());
    vmCommand.add(run.javaPath(run.vmCommand));
    if (run.profile) {
        vmCommand.add("-agentlib:hprof=" + "cpu=samples," + "format=" + (run.profileBinary ? 'b' : 'a') + ","
                + "file=" + run.profileFile + "," + "depth=" + run.profileDepth + "," + "interval="
                + run.profileInterval + "," + "thread=y," + "verbose=n");
    }//from   w w w . j a v  a  2s.c  o  m
    return new VmCommandBuilder(run.log).userDir(workingDirectory).vmCommand(vmCommand);
}

From source file:org.opendaylight.yangtools.yang.data.operations.LeafSetNodeModification.java

@Override
public Optional<LeafSetNode<?>> modify(LeafListSchemaNode schema, Optional<LeafSetNode<?>> actual,
        Optional<LeafSetNode<?>> modification, OperationStack operationStack) throws DataModificationException {

    List<LeafSetEntryNode<?>> resultNodes = Lists.newArrayList();
    if (actual.isPresent()) {
        Iterables.addAll(resultNodes, actual.get().getValue());
    }/*from w  ww . j a v  a2  s. co m*/

    // TODO implement ordering for modification nodes

    for (LeafSetEntryNode<?> leafListModification : modification.get().getValue()) {
        operationStack.enteringNode(leafListModification);

        switch (operationStack.getCurrentOperation()) {
        case MERGE:
        case CREATE: {
            DataModificationException.DataExistsException.check(schema.getQName(), actual,
                    leafListModification);
        }
        case REPLACE: {
            if (!contains(actual, leafListModification)) {
                resultNodes.add(leafListModification);
            }
            break;
        }
        case DELETE: {
            DataModificationException.DataMissingException.check(schema.getQName(), actual,
                    leafListModification);
        }
        case REMOVE: {
            if (resultNodes.contains(leafListModification)) {
                resultNodes.remove(leafListModification);
            }
            break;
        }
        case NONE: {
            break;
        }
        default:
            throw new UnsupportedOperationException(
                    String.format("Unable to perform operation: %s on: %s, unknown",
                            operationStack.getCurrentOperation(), schema));
        }

        operationStack.exitingNode(leafListModification);
    }
    return build(schema, resultNodes);
}

From source file:dagger2.internal.codegen.writer.Modifiable.java

public void addModifiers(Iterable<Modifier> modifiers) {
    Iterables.addAll(this.modifiers, modifiers);
}

From source file:com.facebook.buck.core.util.graph.AbstractBreadthFirstThrowingTraversal.java

public AbstractBreadthFirstThrowingTraversal(Iterable<? extends Node> initialNodes) {
    toExplore = new LinkedList<>();
    Iterables.addAll(toExplore, initialNodes);
    explored = new HashSet<>();
}