Here you can find the source of addUniqueItems(List from, List to)
private static void addUniqueItems(List from, List to)
//package com.java2s; // are made available under the terms of the Eclipse Public License v1.0 import java.util.Iterator; import java.util.List; public class Main { private static void addUniqueItems(List from, List to) { if (from == null || to == null || from.size() == 0) { return; }//from ww w. j av a 2 s. c o m for (Iterator it = from.iterator(); it.hasNext();) { Object o = it.next(); if (!to.contains(o)) { to.add(o); } } } }