Here you can find the source of addAll(Collection
public static <T extends Object> void addAll(Collection<T> target, Collection<T> source)
//package com.java2s; /*/*from ww w .ja va 2s . c om*/ * Copyright 2015-2020 MSUN.comm All right reserved. This software is the confidential and proprietary information of * MSUN.comm ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only * in accordance with the terms of the license agreement you entered into with MSUN.comm. */ import java.util.Collection; public class Main { public static <T extends Object> void addAll(Collection<T> target, Collection<T> source) { if (target != null && source != null && source.size() > 0) { target.addAll(source); } } }