Java Collection Contain containsNull(Collection collection)

Here you can find the source of containsNull(Collection collection)

Description

contains Null

License

Apache License

Declaration

public static boolean containsNull(Collection<?> collection) 

Method Source Code


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

import java.util.Collection;

import java.util.Map;

public class Main {

    public static boolean containsNull(Collection<?> collection) {
        if (!isEmpty(collection)) {
            for (Object obj : collection) {
                if (obj == null) {
                    return true;
                }/*from  w ww.  ja va 2  s.c  om*/
            }
        }
        return false;
    }

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

    public static boolean isEmpty(Map<?, ?> map) {
        return map == null || map.isEmpty();
    }
}

Related

  1. containsKey(Collection keys, String key)
  2. containsNo(Collection baseList, Collection valueList)
  3. containsNone(Collection container, Collection other)
  4. containsNoNull(final Collection c, final String s)
  5. containsNoNulls(Collection container)
  6. containsNull(Collection args)
  7. containsNull(final Collection c)
  8. containsNullsOrEmptyStrings(Collection c)
  9. containsNumber(Collection collection, Number number)

  10. HOME | Copyright © www.java2s.com 2016