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.admin.message.SearchMultiMailboxResponse.java

public void setMsgs(Iterable<MessageInfo> msgs) {
    this.msgs.clear();
    if (msgs != null) {
        Iterables.addAll(this.msgs, msgs);
    }//from   w w  w  .jav a 2s . c  o m
}

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

public void setGrantees(Iterable<ShareGrantee> grantees) {
    this.grantees.clear();
    if (grantees != null) {
        Iterables.addAll(this.grantees, grantees);
    }//from w  w  w.j  a  va 2  s . c  om
}

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

public void setUpdatedAlarms(Iterable<UpdatedAlarmInfo> updatedAlarms) {
    this.updatedAlarms.clear();
    if (updatedAlarms != null) {
        Iterables.addAll(this.updatedAlarms, updatedAlarms);
    }//from w ww.  j a  v  a 2  s . c  om
}

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

public void setIntermediateCAs(Iterable<AidAndFilename> intermediateCAs) {
    this.intermediateCAs.clear();
    if (intermediateCAs != null) {
        Iterables.addAll(this.intermediateCAs, intermediateCAs);
    }//from  w  w w  . ja  v a  2  s  .  co  m
}

From source file:cz.afri.smg.join.SMGJoinMatchObjects.java

private static boolean checkConsistentFields(final SMGObject pObj1, final SMGObject pObj2,
        final SMGNodeMapping pMapping1, final SMGNodeMapping pMapping2, final ReadableSMG pSMG1,
        final ReadableSMG pSMG2) {

    List<SMGEdgeHasValue> fields = new ArrayList<>();

    Iterables.addAll(fields, pSMG1.getHVEdges(SMGEdgeHasValueFilter.objectFilter(pObj1)));
    Iterables.addAll(fields, pSMG2.getHVEdges(SMGEdgeHasValueFilter.objectFilter(pObj2)));

    //TODO: We go through some fields twice, fix
    for (SMGEdgeHasValue hv : fields) {
        SMGEdgeHasValueFilter filter1 = SMGEdgeHasValueFilter.objectFilter(pObj1);
        filter1.filterByType(hv.getType()).filterAtOffset(hv.getOffset());
        Iterable<SMGEdgeHasValue> hv1 = pSMG1.getHVEdges(filter1);

        SMGEdgeHasValueFilter filter2 = SMGEdgeHasValueFilter.objectFilter(pObj2);
        filter2.filterByType(hv.getType()).filterAtOffset(hv.getOffset());
        Iterable<SMGEdgeHasValue> hv2 = pSMG2.getHVEdges(filter2);

        if (hv1.iterator().hasNext() && hv2.iterator().hasNext()) {
            Integer v1 = Iterators.getOnlyElement(hv1.iterator()).getValue();
            Integer v2 = Iterators.getOnlyElement(hv2.iterator()).getValue();
            if (pMapping1.containsKey(v1) && pMapping2.containsKey(v2)
                    && !(pMapping1.get(v1).equals(pMapping2.get(v2)))) {
                return true;
            }/*ww  w  . j a  v a 2 s .  c  om*/
        }
    }

    return false;
}

From source file:edu.mayo.cts2.framework.filter.directory.AbstractNonLazyDirectoryBuilder.java

/**
 * Process set operation./*from w  w  w.  ja  v a 2 s.  co m*/
 *
 * @param i1 the i1
 * @param i2 the i2
 * @param setOperator the set operator
 * @return the collection
 */
protected Collection<T> processSetOperation(final DirectoryBuilder<T> i1, final DirectoryBuilder<T> i2,
        final SetOperator setOperator) {

    Set<T> set1 = new HashSet<T>();
    Set<T> set2 = new HashSet<T>();

    DirectoryResult<T> result1 = i1.resolve();
    DirectoryResult<T> result2 = i2.resolve();

    Iterables.addAll(set1, result1.getEntries());

    Iterables.addAll(set2, result2.getEntries());

    switch (setOperator) {
    case UNION: {
        set1.addAll(set2);
        return set1;
    }
    case INTERSECT: {
        set1.retainAll(set2);
        return set1;
    }
    case SUBTRACT: {
        set1.removeAll(set2);
        return set1;
    }
    }

    return set1;
}

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

public void setMatches(Iterable<AutoCompleteMatch> matches) {
    this.matches.clear();
    if (matches != null) {
        Iterables.addAll(this.matches, matches);
    }/*w ww  . j ava2s .  c o m*/
}

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

public void setSessions(Iterable<SessionInfo> sessions) {
    this.sessions.clear();
    if (sessions != null) {
        Iterables.addAll(this.sessions, sessions);
    }// w w  w . j av  a 2  s. com
}

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

public void setAlarms(Iterable<SnoozeAlarm> alarms) {
    this.alarms.clear();
    if (alarms != null) {
        Iterables.addAll(this.alarms, alarms);
    }/*  w w  w.ja  v a2s . com*/
}

From source file:eu.interedition.text.xml.Converter.java

public Converter add(Iterable<ConverterListener> listeners) {
    Iterables.addAll(this.listeners, listeners);
    return this;
}