Java Array Empty Check isEmpty(Object[] obj)

Here you can find the source of isEmpty(Object[] obj)

Description

is Empty

License

Open Source License

Declaration

public static boolean isEmpty(Object[] obj) 

Method Source Code


//package com.java2s;

import java.util.*;

public class Main {

    public static boolean isEmpty(String str) {
        return null == str || "".equals(str);
    }//  w ww. ja v  a  2 s  .  com

    public static boolean isEmpty(Object[] obj) {
        return null == obj || 0 == obj.length;
    }

    public static boolean isEmpty(Object obj) {
        if (null == obj) {
            return true;
        }
        if (obj instanceof String) {
            return ((String) obj).trim().isEmpty();
        }
        return !(obj instanceof Number) ? false : false;
    }

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

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

Related

  1. isEmpty(Object[] array)
  2. isEmpty(Object[] array)
  3. isEmpty(Object[] array)
  4. isEmpty(Object[] array)
  5. isEmpty(Object[] arrs)
  6. isEmpty(Object[] values)
  7. isEmpty(String[] array)
  8. isEmpty(T[] arr)
  9. isEmpty(T[] arr)