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.google.devtools.build.lib.util.CommandBuilder.java

public CommandBuilder addArgs(Iterable<String> args) {
    Preconditions.checkArgument(!Iterables.contains(args, null), "Arguments must not be null");
    Iterables.addAll(argv, args);
    return this;
}

From source file:org.xacml4j.v30.spi.pip.ContentResolverDescriptorBuilder.java

public ContentResolverDescriptorBuilder keys(Iterable<AttributeReferenceKey> keys) {
    Iterables.addAll(this.keys, keys);
    return this;
}

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

public void setCalResources(Iterable<CalendarResourceInfo> calResources) {
    this.calResources.clear();
    if (calResources != null) {
        Iterables.addAll(this.calResources, calResources);
    }//from  w  w  w.j  a  v a  2  s  . com
}

From source file:org.opentestsystem.shared.progman.transformer.TenantComponentTransformer.java

@Override
public Tenant apply(final Tenant tenant) {
    if (tenant != null && tenant.getTenantSubscriptions() != null) {
        final Iterable<TenantSubscription> matchingTenantSubscriptionList = Iterables.transform(
                Iterables.filter(tenant.getTenantSubscriptions(), this.matchingTenantSub),
                this.tenantSubscriptionTransformer);
        final List<TenantSubscription> tenantSubsToPreserve = Lists.newArrayList(
                Iterables.filter(tenant.getTenantSubscriptions(), Predicates.not(this.matchingTenantSub)));
        if (this.retain) {
            Iterables.addAll(tenantSubsToPreserve, matchingTenantSubscriptionList);
        }//w w w.  j  av a2s.c  o m
        tenant.setTenantSubscriptions(tenantSubsToPreserve);
    }
    return tenant;
}

From source file:net.derquinse.common.orm.Entities.java

/** Clears the target set and inserts every non-null element from the source iterable. */
public static <T> void pushSet(Set<T> target, Iterable<? extends T> source) {
    checkNotNull(target);//  w w w. j  a  v a 2  s . c  o m
    target.clear();
    if (source != null) {
        Iterables.addAll(target, Iterables.filter(source, Predicates.notNull()));
    }
}

From source file:com.continuuity.weave.internal.ZKWeaveController.java

public ZKWeaveController(ZKClient zkClient, RunId runId, Iterable<LogHandler> logHandlers) {
    super(zkClient, runId);
    this.logHandlers = new ConcurrentLinkedQueue<LogHandler>();
    Iterables.addAll(this.logHandlers, logHandlers);
    this.kafkaClient = new SimpleKafkaClient(ZKClients.namespace(zkClient, "/" + runId + "/kafka"));
    this.discoveryServiceClient = new ZKDiscoveryService(zkClient);
    this.logPoller = createLogPoller();
}

From source file:com.facebook.buck.rules.keys.RuleKeyDiagnostics.java

/**
 * Computes the diagnostic rulekey data for the given rule and all of its appendables recursively.
 * Previously processed rules and appendables are skipped and not fed to the consumer. Results for
 * the newly processed rule and appendables are fed to the consumer, but not stored otherwise.
 * Only information of whether something has been processed or not gets stored.
 *///from  ww w .j av a 2s  .c  o m
public void processRule(BuildRule rule, Consumer<Result<RULE_KEY, DIAG_KEY>> resultConsumer) {
    if (!computed.add(rule)) {
        return;
    }
    Queue<AddsToRuleKey> appendableQueue = new LinkedList<>();
    Result<RULE_KEY, DIAG_KEY> result = ruleResultSupplier.apply(rule);
    Iterables.addAll(appendableQueue, result.appendables);
    resultConsumer.accept(result);
    while (!appendableQueue.isEmpty()) {
        AddsToRuleKey appendable = appendableQueue.remove();
        if (computed.add(appendable)) {
            result = appendableResultSupplier.apply(appendable);
            Iterables.addAll(appendableQueue, result.appendables);
            resultConsumer.accept(result);
        }
    }
}

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

public void setAccounts(Iterable<Name> accounts) {
    this.accounts.clear();
    if (accounts != null) {
        Iterables.addAll(this.accounts, accounts);
    }//from   w w  w  . j  a va2 s. co  m
}

From source file:org.yakindu.base.expressions.scoping.AbstractLibraryGlobalScopeProvider.java

@Override
public IScope getScope(Resource context, EReference reference, Predicate<IEObjectDescription> filter) {
    List<IEObjectDescription> descriptions = Lists.newArrayList();
    for (URI uri : getValidLibraries(context)) {
        try {//from  w  w  w .  j a  v  a  2s .c  o  m
            Iterables.addAll(descriptions, libraryCache.get(uri, new Callable<Iterable<IEObjectDescription>>() {

                @Override
                public Iterable<IEObjectDescription> call() throws Exception {
                    return getDescriptions(context, uri);
                }
            }));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return SelectableBasedScope.createScope(IScope.NULLSCOPE, new EObjectDescriptionLookUp(descriptions),
            reference.getEReferenceType(), isIgnoreCase(reference));
}

From source file:org.eclipse.xtend.ide.builder.XtendParallelBuilderParticipant.java

@Override
protected Map<OutputConfiguration, Iterable<IMarker>> getGeneratorMarkers(IProject builtProject,
        Collection<OutputConfiguration> outputConfigurations) throws CoreException {
    Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers = newHashMap();
    List<IPath> sourcePath = getSourceFolderPathes(builtProject);
    for (OutputConfiguration config : outputConfigurations) {
        if (config.isCleanUpDerivedResources()) {
            List<IContainer> containerToSearchIn = Lists.newArrayList();
            for (IPath sourceFolder : sourcePath) {
                if (sourceFolder.segmentCount() == 1) {
                    containerToSearchIn.add(builtProject);
                } else {
                    IContainer sourcePathBasedContainer = builtProject.getWorkspace().getRoot()
                            .getFolder(sourceFolder);
                    containerToSearchIn.add(sourcePathBasedContainer);
                }// w ww  .  ja v a  2  s.c o  m
            }
            Collection<IMarker> markers = Lists.newArrayList();
            for (IContainer container : containerToSearchIn) {
                Iterables.addAll(markers, getDerivedResourceMarkers().findDerivedResourceMarkers(container,
                        getGeneratorIdProvider().getGeneratorIdentifier()));
            }
            generatorMarkers.put(config, markers);
        }
    }
    return buildGeneratorMarkersReverseLookupMap(generatorMarkers);
}