Java List Contain addAllIfNotContained(List dst, Collection src)

Here you can find the source of addAllIfNotContained(List dst, Collection src)

Description

add All If Not Contained

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static void addAllIfNotContained(List dst, Collection src) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

import java.util.List;

public class Main {
    @SuppressWarnings("unchecked")
    public static void addAllIfNotContained(List dst, Collection src) {
        for (Object object : src) {
            addIfNotContained(dst, object);
        }//  w ww  .  j av  a 2  s .c o  m
    }

    @SuppressWarnings("unchecked")
    public static void addIfNotContained(List list, Object object) {
        if (!list.contains(object)) {
            list.add(object);
        }
    }
}

Related

  1. addIfNotContained(List list, Object object)
  2. contains(final List list, final String str)
  3. contains(final List requested, final List claimed)
  4. contains(final List list, T value)