Java List Merge merge(List l1, List l2)

Here you can find the source of merge(List l1, List l2)

Description

merge

License

Open Source License

Declaration

public static List<String> merge(List<String> l1, List<String> l2) 

Method Source Code

//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();
    }
}

Related

  1. merge(List bs)
  2. merge(List left, List right)
  3. merge(List list1, List list2)
  4. merge(List> list)
  5. merge(List l1, List l2)
  6. merge(List list)
  7. merge(List lst1, List lst2)
  8. merge(List stringList)
  9. merge(List text)