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.account.message.SearchCalendarResourcesResponse.java

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

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

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

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

public void setArgs(Iterable<NamedValue> args) {
    this.args.clear();
    if (args != null) {
        Iterables.addAll(this.args, args);
    }// w  ww  .ja  va  2 s . c o m
}

From source file:org.eclipse.viatra.addon.validation.runtime.ConstraintExtensionRegistry.java

/**
 * Returns the registered constraint specifications for a particular editor Id.
 * /*from w w  w . j  a  v a2  s  .co m*/
 * @param editorId
 *            The editor Id for which the constraint specifications should be retrieved.
 * @return The Set of constraint specifications registered.
 */
public static synchronized Set<IConstraintSpecification> getConstraintSpecificationsForEditorId(
        String editorId) {
    if (genericEditorIds.contains(editorId)) {
        Iterable<IConstraintSpecification> constraintSpecifications = unwrapConstraintSpecifications(
                getEditorConstraintSpecificationMap().values());
        return ImmutableSet.copyOf(constraintSpecifications);
    }
    Set<IConstraintSpecification> set = Sets
            .newHashSet(unwrapConstraintSpecifications(getEditorConstraintSpecificationMap().get(editorId)));
    Iterables.addAll(set,
            unwrapConstraintSpecifications(getEditorConstraintSpecificationMap().get(WILDCARD_EDITOR_ID)));
    return set;
}

From source file:com.opengamma.id.ExternalIdSearch.java

/**
 * Adds a identifiers to the set of searched for identifiers.
 * // ww  w  .ja  v  a2 s .com
 * @param externalIds  the identifiers to add, not null
 */
public void addExternalIds(Iterable<ExternalId> externalIds) {
    ArgumentChecker.noNulls(externalIds, "externalIds");
    Iterables.addAll(_externalIds, externalIds);
}

From source file:org.apache.mahout.knn.search.ProjectionSearch.java

public List<Vector> search(final Vector query, int n, int searchSize) {
    List<Vector> top = Lists.newArrayList();
    for (TreeSet<Vector> v : vectors) {
        Iterables.addAll(top, Iterables.limit(v.tailSet(query, true), searchSize));
        Iterables.addAll(top, Iterables.limit(v.headSet(query, false).descendingSet(), searchSize));
    }//  w  ww.  j av  a2s.  c o  m
    System.out.print(top.size());
    removeDuplicate(top);
    System.out.print(" ");
    System.out.println(top.size());

    // if searchSize * vectors.size() is small enough not to cause much memory pressure, this is probably
    // just as fast as a priority queue here.
    Collections.sort(top, byQueryDistance(query));
    return top.subList(0, n);
}

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

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

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

public void setComponents(Iterable<ExpandedRecurrenceComponent> components) {
    this.components.clear();
    if (components != null) {
        Iterables.addAll(this.components, components);
    }/*w w w.jav a2s.co m*/
}

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

public void setMissingBlobs(Iterable<MissingBlobInfo> missingBlobs) {
    this.missingBlobs.clear();
    if (missingBlobs != null) {
        Iterables.addAll(this.missingBlobs, missingBlobs);
    }//from  w  w  w. j  av  a 2s .  co m
}

From source file:org.csanchez.jenkins.plugins.kubernetes.pipeline.EvictingQueue.java

@Override
public boolean addAll(Collection<? extends E> collection) {
    int size = collection.size();
    if (size >= maxSize) {
        clear();/*ww  w.  ja v  a2  s .c  om*/
        return Iterables.addAll(this, Iterables.skip(collection, size - maxSize));
    }
    return standardAddAll(collection);
}