Java Array Empty Check isEmpty(Object[] array)

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

Description

is Empty

License

Apache License

Declaration

public static final boolean isEmpty(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 final boolean isEmpty(Collection<?> collection) {
        if (collection == null) {
            return true;
        }//from  ww  w  .  ja  va 2s. c om
        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. isEmpty(Object[] array)
  2. isEmpty(Object[] array)
  3. isEmpty(Object[] array)
  4. isEmpty(Object[] array)
  5. isEmpty(Object[] array)
  6. isEmpty(Object[] arrs)
  7. isEmpty(Object[] obj)
  8. isEmpty(Object[] values)
  9. isEmpty(String[] array)