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.GetDistributionListMembersResponse.java

public void setDlMembers(Iterable<String> dlMembers) {
    this.dlMembers.clear();
    if (dlMembers != null) {
        Iterables.addAll(this.dlMembers, dlMembers);
    }/*w ww . j  a  v a2 s.  c o  m*/
}

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

public void setAccounts(Iterable<Id> accounts) {
    this.accounts.clear();
    if (accounts != null) {
        Iterables.addAll(this.accounts, accounts);
    }//w ww  .  ja  v a2 s . co m
}

From source file:com.analog.lyric.benchmarking.utils.doublespace.JointIndexer.java

/**
 * Constructs a joint indexer given an Iterable of indexers.
 * //from www .  j a  v a  2s  .c  om
 * @param indexers
 *            The individual indexers, one for each dimension to index.
 */
public JointIndexer(Iterable<Indexer> indexers) {
    _indexers = new ArrayList<Indexer>();
    Iterables.addAll(_indexers, indexers);
    _cardinality = computeCardinality(_indexers);
    _dimensions = new int[_indexers.size()];
    for (int i = 0; i < _dimensions.length; i++) {
        _dimensions[i] = _indexers.get(i).getCardinality();
    }
}

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

public EffectiveRightsInfo setRights(Iterable<RightWithName> rights) {
    this.rights.clear();
    if (rights != null) {
        Iterables.addAll(this.rights, rights);
    }/*w  ww . j  av a2  s .c  o  m*/
    return this;
}

From source file:org.jclouds.vcloud.domain.internal.OrgImpl.java

public OrgImpl(String name, String type, URI id, String fullName, String description,
        Map<String, ReferenceType> catalogs, Map<String, ReferenceType> vdcs,
        Map<String, ReferenceType> networks, @Nullable ReferenceType tasksList, Iterable<Task> tasks) {
    super(name, type, id);
    this.fullName = checkNotNull(fullName, "fullName");
    this.description = description;
    this.catalogs.putAll(checkNotNull(catalogs, "catalogs"));
    this.vdcs.putAll(checkNotNull(vdcs, "vdcs"));
    this.networks.putAll(checkNotNull(networks, "networks"));
    this.tasksList = tasksList;
    Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
}

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

public void setAccounts(Iterable<SyncGalAccountSpec> accounts) {
    this.accounts.clear();
    if (accounts != null) {
        Iterables.addAll(this.accounts, accounts);
    }/*from   ww  w  .j a va2 s .  c om*/
}

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

public void setSessions(Iterable<SimpleSessionInfo> sessions) {
    this.sessions.clear();
    if (sessions != null) {
        Iterables.addAll(this.sessions, sessions);
    }/*from   ww  w.j a  v a  2  s  .co  m*/
}

From source file:org.apache.calcite.util.ImmutableNullableList.java

/**
 * Returns an immutable list containing the given elements, in order.
 *
 * <p>Behavior as/* w w w. j a  v  a2 s  . c  o  m*/
 * {@link com.google.common.collect.ImmutableList#copyOf(Iterable)}
 * except that this list allows nulls.
 */
public static <E> List<E> copyOf(Iterable<? extends E> elements) {
    if (elements instanceof ImmutableNullableList || elements instanceof ImmutableList
            || elements == SINGLETON_NULL) {
        //noinspection unchecked
        return (List<E>) elements;
    }
    if (elements instanceof Collection) {
        //noinspection unchecked
        return copyOf((Collection) elements);
    }
    // If there are no nulls, ImmutableList is better.
    final List<E> list = new ArrayList<>();
    Iterables.addAll(list, elements);
    if (list.contains(null)) {
        return ImmutableNullableList.copyOf(list);
    }
    return ImmutableList.copyOf(elements);
}

From source file:org.apache.drill.exec.schema.ObjectSchema.java

@Override
public Iterable<? extends Field> removeUnreadFields() {
    final List<Field> removedFields = Lists.newArrayList();
    Iterables.removeIf(fields.values(), new Predicate<Field>() {
        @Override/*w w w. j  a  v  a  2s  . c o  m*/
        public boolean apply(Field field) {
            if (!field.isRead()) {
                removedFields.add(field);
                return true;
            } else if (field.hasSchema()) {
                Iterables.addAll(removedFields, field.getAssignedSchema().removeUnreadFields());
            }

            return false;
        }
    });
    return removedFields;
}

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

public void setMisspelledWords(Iterable<Misspelling> misspelledWords) {
    this.misspelledWords.clear();
    if (misspelledWords != null) {
        Iterables.addAll(this.misspelledWords, misspelledWords);
    }// w  w w .  j  av a 2s . c om
}