Java List Contain addIfNotContained(List list, Object object)

Here you can find the source of addIfNotContained(List list, Object object)

Description

add If Not Contained

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static void addIfNotContained(List list, Object object) 

Method Source Code

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

import java.util.List;

public class Main {
    @SuppressWarnings("unchecked")
    public static void addIfNotContained(List list, Object object) {
        if (!list.contains(object)) {
            list.add(object);/*  www  .  j  a v a 2  s.  co m*/
        }
    }
}

Related

  1. addAllIfNotContained(List dst, Collection src)
  2. contains(final List list, final String str)
  3. contains(final List requested, final List claimed)
  4. contains(final List list, T value)
  5. contains(final String text, final List tokens)