Here you can find the source of addAll(final Collection super E> thingsToBeAddedTo, final Collection extends E> thingsToAdd)
Parameter | Description |
---|---|
thingsToBeAddedTo | , which must be non-null. |
Parameter | Description |
---|---|
IllegalArgumentException | if thingsToBeAddedTo is null. |
public static <E> void addAll(final Collection<? super E> thingsToBeAddedTo, final Collection<? extends E> thingsToAdd)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.Map; public class Main { /**/*from w ww . j a v a 2s.co m*/ * Adds thingsToAdd to thingsToBeAddedTo. * * @param thingsToBeAddedTo * , which must be non-null. * @throws IllegalArgumentException * if thingsToBeAddedTo is null. * */ public static <E> void addAll(final Collection<? super E> thingsToBeAddedTo, final Collection<? extends E> thingsToAdd) { if (thingsToBeAddedTo == null) { throw new IllegalArgumentException("There's no thingsToBeAddedTo!"); } if (!isEmpty(thingsToAdd)) { thingsToBeAddedTo.addAll(thingsToAdd); } } public static boolean isEmpty(Iterable<?> i) { if (i instanceof Collection) return ((Collection<?>) i).isEmpty(); return i == null || !i.iterator().hasNext(); } public static boolean isEmpty(Map<?, ?> p_oCol) { return p_oCol == null || p_oCol.isEmpty(); } }