Java Collection Contain containsNo(Collection baseList, Collection valueList)

Here you can find the source of containsNo(Collection baseList, Collection valueList)

Description

Checks if the given basic list contains any element of the given value list.

License

Open Source License

Parameter

Parameter Description
T Type of collection elements
baseList List to check for occurrences
valueList Values to search

Return

true if baseList contains any element of valueList; false otherwise

Declaration

public static <T> boolean containsNo(Collection<T> baseList, Collection<T> valueList) 

Method Source Code

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

import java.util.Collection;

public class Main {
    /**/*from w  w w . jav  a2  s. com*/
     * Checks if the given basic list contains any element of the given value
     * list.
     * 
     * @param <T>
     *            Type of collection elements
     * @param baseList
     *            List to check for occurrences
     * @param valueList
     *            Values to search
     * @return <code>true</code> if <code>baseList</code> contains any element
     *         of <code>valueList</code>; <code>false</code> otherwise
     */
    public static <T> boolean containsNo(Collection<T> baseList, Collection<T> valueList) {
        for (T v : valueList) {
            if (baseList.contains(v)) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. containsIgnoreCase4Collections(Collection c, String s)
  2. containsInstance(Collection collection, Object element)
  3. containsInstance(Collection collection, Object element)
  4. containsInstanceOf(Collection collection, Class c)
  5. containsKey(Collection keys, String key)
  6. containsNone(Collection container, Collection other)
  7. containsNoNull(final Collection c, final String s)
  8. containsNoNulls(Collection container)
  9. containsNull(Collection collection)