Java Collection Empty isNotEmpty(Collection values)

Here you can find the source of isNotEmpty(Collection values)

Description

is Not Empty

License

Open Source License

Declaration

public static <T> boolean isNotEmpty(Collection<T> values) 

Method Source Code


//package com.java2s;

import java.util.Collection;

import java.util.Map;

public class Main {
    public static <T> boolean isNotEmpty(Collection<T> values) {
        return !isEmpty(values);
    }/*ww w.  java 2  s .  c  o m*/

    public static <T> boolean isNotEmpty(T[] vals) {
        return !isEmpty(vals);
    }

    public static <T> boolean isEmpty(T[] vals) {
        return vals == null || vals.length == 0;
    }

    public static <T> boolean isEmpty(T[] vals, boolean checkNullVal) {
        boolean isEmpty = vals == null || vals.length == 0;
        if (isEmpty) {
            return true;
        }
        if (checkNullVal) {
            for (T val : vals) {
                if (val != null) {
                    return false;
                }
            }
            isEmpty = true;
        }
        return isEmpty;
    }

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

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

Related

  1. isNotEmpty(Collection source)
  2. isNotEmpty(Collection values)
  3. isNotEmpty(Collection... colls)
  4. isNotEmpty(Collection collection)
  5. isNotEmpty(Collection collection)
  6. isNotEmpty(E collection)
  7. isNotEmpty(final Collection coll)
  8. isNotEmpty(final Collection collection)
  9. isNotEmpty(final Collection collection)