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.util.WrappedElementInfo.java

public Iterable<String> getElementNames() {
    List<String> elemNames = Lists.newArrayList();
    for (JaxbNodeInfo node : wrappedElems) {
        if (node instanceof JaxbPseudoNodeChoiceInfo) {
            JaxbPseudoNodeChoiceInfo pseudoNode = (JaxbPseudoNodeChoiceInfo) node;
            Iterables.addAll(elemNames, pseudoNode.getElementNames());
        } else {//from   ww  w  .  j av  a  2 s . c  o m
            elemNames.add(node.getName());
        }
    }
    return elemNames;
}

From source file:org.jclouds.aws.s3.domain.internal.TreeSetListBucketResponse.java

public TreeSetListBucketResponse(String name, Iterable<ObjectMetadata> contents, String prefix, String marker,
        int maxKeys, String delimiter, boolean isTruncated, SortedSet<String> commonPrefixes) {
    Iterables.addAll(this, contents);
    this.name = name;
    this.prefix = prefix;
    this.marker = marker;
    this.maxKeys = maxKeys;
    this.truncated = isTruncated;
    this.delimiter = delimiter;
    this.commonPrefixes = commonPrefixes;
}

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

public static List<ZimletProperty> toInterfaces(Iterable<AdminZimletProperty> params) {
    if (params == null)
        return null;
    List<ZimletProperty> newList = Lists.newArrayList();
    Iterables.addAll(newList, params);
    return newList;
}

From source file:fr.letroll.ttorrentandroid.client.tracker.TrackerClient.java

/** Returns a fresh, concrete list. */
@Nonnull//from  ww w.j a  v a  2s  .  com
protected List<InetSocketAddress> getPeerAddresses() {
    List<InetSocketAddress> out = new ArrayList<InetSocketAddress>();
    Iterables.addAll(out, this.peerAddresses);
    Collections.sort(out, InetSocketAddressComparator.INSTANCE);
    return out;
}

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

public void setZimlets(Iterable<AdminZimletInfo> zimlets) {
    this.zimlets.clear();
    if (zimlets != null) {
        Iterables.addAll(this.zimlets, zimlets);
    }/*  w  w w.  j a  va2  s.  c  om*/
}

From source file:org.yakindu.sct.generator.genmodel.scoping.SGenGlobalScopeProvider.java

/**
 * Overidden to avoid scope nesting which comes with shadowing problems when
 * potential elements in scope have the same name
 *///w  w w  .  j  a  v  a 2  s .  c  om
@Override
protected IScope getScope(IScope parent, final Resource context, boolean ignoreCase, EClass type,
        Predicate<IEObjectDescription> filter) {
    IScope result = parent;
    if (context == null || context.getResourceSet() == null)
        return result;
    List<IContainer> containers = Lists.newArrayList(getVisibleContainers(context));
    Collections.reverse(containers);
    List<IEObjectDescription> objectDescriptions = new ArrayList<IEObjectDescription>();
    Iterator<IContainer> iter = containers.iterator();
    while (iter.hasNext()) {
        IContainer container = iter.next();
        result = createContainerScopeWithContext(context, IScope.NULLSCOPE, container, filter, type,
                ignoreCase);
        Iterables.addAll(objectDescriptions, result.getAllElements());
    }
    return new SimpleScope(objectDescriptions);
}

From source file:org.eclipse.sirius.business.internal.contribution.ContributionFinder.java

/**
 * Returns a contribution provider which looks for all the
 * {@link Contribution} elements contained inside the input model (including
 * the input model itself if it is a contribution.
 * /*from ww w  . j av  a 2s  .  co  m*/
 * @return a function which finds all the Contribution elements in the input
 *         model.
 */
public static Function<Iterable<EObject>, Iterable<Contribution>> intrinsic() {
    return new Function<Iterable<EObject>, Iterable<Contribution>>() {
        public Iterable<Contribution> apply(Iterable<EObject> from) {
            List<Contribution> result = Lists.newArrayList();
            for (EObject root : from) {
                Iterables.addAll(result,
                        Iterables.filter(
                                AllContents.of(root, ContributionPackage.eINSTANCE.getContribution(), true),
                                Contribution.class));
            }
            return result;
        }
    };
}

From source file:com.zimbra.soap.mail.type.BounceMsgSpec.java

public void setEmailAddresses(Iterable<EmailAddrInfo> emailAddresses) {
    this.emailAddresses.clear();
    if (emailAddresses != null) {
        Iterables.addAll(this.emailAddresses, emailAddresses);
    }/*from   ww w .j  a va  2 s  . co m*/
}

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

public void setItems(Iterable<QueueSummaryItem> items) {
    this.items.clear();
    if (items != null) {
        Iterables.addAll(this.items, items);
    }/*from w w  w . ja v a2s .  co m*/
}

From source file:org.gradle.model.internal.type.ModelTypes.java

/**
 * Collect all types that make up the type hierarchy of the given types.
 *///  w  w w .j  av  a  2 s.  c o m
public static Set<ModelType<?>> collectHierarchy(Iterable<? extends ModelType<?>> types) {
    Queue<ModelType<?>> queue = new ArrayDeque<ModelType<?>>(Iterables.size(types) * 2);
    Iterables.addAll(queue, types);
    Set<ModelType<?>> seenTypes = Sets.newLinkedHashSet();
    ModelType<?> type;
    while ((type = queue.poll()) != null) {
        // Do not process Object's or GroovyObject's methods
        Class<?> rawClass = type.getRawClass();
        if (rawClass.equals(Object.class) || rawClass.equals(GroovyObject.class)) {
            continue;
        }
        // Do not reprocess
        if (!seenTypes.add(type)) {
            continue;
        }

        Class<?> superclass = rawClass.getSuperclass();
        if (superclass != null) {
            ModelType<?> superType = ModelType.of(superclass);
            if (!seenTypes.contains(superType)) {
                queue.add(superType);
            }
        }
        for (Class<?> iface : rawClass.getInterfaces()) {
            ModelType<?> ifaceType = ModelType.of(iface);
            if (!seenTypes.contains(ifaceType)) {
                queue.add(ifaceType);
            }
        }
    }

    return seenTypes;
}