Java tutorial
//package com.java2s; import java.util.List; public class Main { public static <T> void addAllIgnoreDuplicates(List<T> collection, List<T> newEntities) { for (T newEntity : newEntities) { if (!collection.contains(newEntity)) collection.add(newEntity); } } }