Here you can find the source of addAllToList(List
public static <T> List<T> addAllToList(List<T> dest, Collection<T> src)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.List; public class Main { public static <T> List<T> addAllToList(List<T> dest, Collection<T> src) { if (isEmpty(src)) { return dest; }//from w w w . ja v a2s.co m for (T item : src) { if (!dest.contains(item)) { dest.add(item); } } return dest; } public static boolean isEmpty(Collection<?> collection) { return collection == null || collection.isEmpty(); } }