Java Collection Add addAll(Collection intoCollection, Collection fromCollection)

Here you can find the source of addAll(Collection intoCollection, Collection fromCollection)

Description

Adds all the items in "fromCollection" into "intoCollection".

License

Open Source License

Parameter

Parameter Description
intoCollection a parameter
fromCollection a parameter

Declaration

public static <T> void addAll(Collection<T> intoCollection,
        Collection<? extends T> fromCollection) 

Method Source Code

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

import java.util.Collection;

public class Main {
    /**/*  w ww  . j  av  a 2  s.  co m*/
     * Adds all the items in "fromCollection" into "intoCollection".
     * <BR>
     * There was a bug in some implementations of Collection.addAll() method in some versions of J2SE, so to be on the
     * safe side, I implement it here.
     * @param intoCollection
     * @param fromCollection
     */
    public static <T> void addAll(Collection<T> intoCollection,
            Collection<? extends T> fromCollection) {
        for (T t : fromCollection) {
            intoCollection.add(t);
        }
    }
}

Related

  1. addAll(Collection collection, T[] array)
  2. addAll(Collection collection, T[] items)
  3. addAll(Collection dest, Collection src, Class type)
  4. addAll(Collection dest, Collection orig)
  5. addAll(Collection dest, T... elements)
  6. addAll(Collection left, Collection right)
  7. addAll(Collection t1, Iterable t2)
  8. addAll(Collection target, Collection source)
  9. addAll(Collection target, Iterable source)