Here you can find the source of merge(List
public static List<String> merge(List<String> l1, List<String> l2)
//package com.java2s; import java.util.List; public class Main { public static List<String> merge(List<String> l1, List<String> l2) { if (isEmpty(l1)) { return l2; }//w ww.j ava2 s. c om if (isEmpty(l2)) { return l1; } for (String o : l2) { if (!l1.contains(o)) { l1.add(o); } } return l1; } public static boolean isEmpty(List<?> list) { return null == list || list.isEmpty(); } }