Java List Value Add All addAllToList(List dest, Collection src)

Here you can find the source of addAllToList(List dest, Collection src)

Description

add All To List

License

Apache License

Declaration

public static <T> List<T> addAllToList(List<T> dest, Collection<T> src) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

import java.util.List;

public class Main {

    public static <T> List<T> addAllToList(List<T> dest, Collection<T> src) {
        if (isEmpty(src)) {
            return dest;
        }//from   w  w w . ja v  a2s.co  m
        for (T item : src) {
            if (!dest.contains(item)) {
                dest.add(item);
            }
        }
        return dest;
    }

    public static boolean isEmpty(Collection<?> collection) {
        return collection == null || collection.isEmpty();
    }
}

Related

  1. addAll(Object[] array, List list)
  2. addAll(T[] array, List list)
  3. addAllTo(List procArgs, String[] args)
  4. addAllTo(List list, T... args)
  5. addAllToANewList(Collection... collections)
  6. addAllUnique(List aList, List theObjects)
  7. addAllUnique(List l1, T element)
  8. addAllUniqueId(List aList, List theObjects)
  9. addAllUniqueToList(List objects, List objectsToAdd)