Java Array Empty Check isNotEmpty(Object[] array)

Here you can find the source of isNotEmpty(Object[] array)

Description

is Not Empty

License

Apache License

Declaration

public static final boolean isNotEmpty(Object[] array) 

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 isNotEmpty(Collection<?> collection) {
        return !isEmpty(collection);
    }//from w w  w . j a va2 s  .  co m

    public static boolean isNotEmpty(Map<?, ?> map) {
        return !isEmpty(map);
    }

    public static final boolean isNotEmpty(Object[] array) {
        return !isEmpty(array);
    }

    public static boolean isNotEmpty(String s) {
        return !isEmpty(s);
    }

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

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

    public static final boolean isEmpty(Object[] array) {
        if (array == null) {
            return true;
        }
        return array.length == 0;
    }

    public static boolean isEmpty(String s) {
        if (s == null) {
            return true;
        }
        return s.length() == 0;
    }
}

Related

  1. isEmptyOrNull(Object[] array)
  2. isEmptyOrNull(Object[] array)
  3. isNonEmpty(Object[] array)
  4. isNotEmpty(boolean[] values)
  5. isNotEmpty(Object[] array)
  6. isNotEmpty(Object[] array)
  7. isNotEmpty(Object[] array)
  8. isNotEmpty(Object[] arrs)
  9. isNotEmpty(Object[] ObjectArray)