Java Is Null isNullOrEmpty(Object[] array)

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

Description

is Null Or Empty

License

Open Source License

Declaration

public static boolean isNullOrEmpty(Object[] array) 

Method Source Code


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

import java.io.File;
import java.util.Collection;
import java.util.Date;
import java.util.Map;

public class Main {
    public static boolean isNullOrEmpty(String value) {

        return (value == null) || (value.trim().length() == 0);
    }/*from  w w  w .  jav a 2  s  .  co m*/

    public static boolean isNullOrEmpty(Object value) {

        return value == null;
    }

    public static <T> boolean isNullOrEmpty(Collection<T> collection) {

        return (collection == null) || (collection.isEmpty());
    }

    public static boolean isNullOrEmpty(Number number) {

        return (number == null) || (!(number.doubleValue() > 0));
    }

    public static boolean isNullOrEmpty(Date data) {

        return data == null;
    }

    public static <T> boolean isNullOrEmpty(Map<T, T> map) {

        return (map == null) || (map.isEmpty());
    }

    public static boolean isNullOrEmpty(File file) {

        return isNull(file) || file.length() == 0;
    }

    public static boolean isNullOrEmpty(Object[] array) {

        return (array == null) || (array.length == 0);
    }

    public static boolean isNull(Object value) {

        return value == null;
    }
}

Related

  1. isNotNull(File file)
  2. isNotNullOrEmpty(final Object[] array)
  3. isNull(File file)
  4. isNull(Object s)
  5. isNull(String sIn)