Java Collection Add addAll(T[] lhs, Collection rhs)

Here you can find the source of addAll(T[] lhs, Collection rhs)

Description

Add all elements from an array into a given collection of the same type.

License

Open Source License

Parameter

Parameter Description
lhs The left-hand side. Elements of this array will be added to the collection.
rhs The right-hand side. Elements from the left-hand side will be added to this collection.

Declaration

public static <T> void addAll(T[] lhs, Collection<T> rhs) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    /**/*from  www.j  av a  2 s. c o  m*/
     * Add all elements from an array into a given collection of the same type.
     *
     * @param lhs
     *            The left-hand side. Elements of this array will be added to
     *            the collection.
     * @param rhs
     *            The right-hand side. Elements from the left-hand side will be
     *            added to this collection.
     */
    public static <T> void addAll(T[] lhs, Collection<T> rhs) {
        for (int i = 0; i != lhs.length; ++i) {
            rhs.add(lhs[i]);
        }
    }
}

Related

  1. addAll(final TCollection target, final Iterable source)
  2. addAll(Iterable iterable, Collection collection)
  3. addAll(Iterable iterable, Collection collection)
  4. addAll(S collection, T... values)
  5. addAll(T coll, Collection other)
  6. addAllFirst(Collection col, Deque deque)
  7. addAllIfNotNull(final Collection collection, final Collection c)
  8. addAllIfNotNull(final Collection collection, final Collection values)
  9. addAllIfSet(Collection target, Collection c)