Here you can find the source of addAll(final TCollection target, final Iterable extends TElement> source)
Parameter | Description |
---|---|
TElement | The type of the elements of the given collection. |
TCollection | The type of the given collection. |
target | The given collection to copy values to. |
source | The given source of values. |
public static <TElement, TCollection extends Collection<TElement>> TCollection addAll(final TCollection target, final Iterable<? extends TElement> source)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { /**/*from w w w.j a v a2s .co m*/ * Adds all the elements of the given source to the given target collection. * * @param <TElement> The type of the elements of the given collection. * @param <TCollection> The type of the given collection. * @param target The given collection to copy values to. * @param source The given source of values. * @return The given target collection (for chaining purposes). * @note If either the source or the target are not effective, no * modifications are made. */ public static <TElement, TCollection extends Collection<TElement>> TCollection addAll(final TCollection target, final Iterable<? extends TElement> source) { if (target != null && source != null) { for (TElement element : source) { target.add(element); } } return target; } }