Here you can find the source of merge(List
protected static <T> List<T> merge(List<T> list, List<T> items)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { protected static <T> List<T> merge(List<T> list, List<T> items) { if (list != null) { if (items != null) { for (T item : items) { if (!list.contains(item)) { list.add(item);/*from w w w . java2 s .c o m*/ } } } } else { return items; } return list; } }