Java Array Empty Check isEmpty(T[] arr)

Here you can find the source of isEmpty(T[] arr)

Description

return array is empty

License

Apache License

Declaration

public static <T> boolean isEmpty(T[] arr) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

import java.util.Map;

public class Main {
    /**// ww w .ja v a2s  .c  o m
     * return collection is empty
     */
    public static <E> boolean isEmpty(Collection<E> c) {
        return (null == c || c.isEmpty());
    }

    /**
     * return map is empty
     */
    public static <K, V> boolean isEmpty(Map<K, V> map) {
        return (null == map || map.isEmpty());
    }

    /**
     * return array is empty
     */
    public static <T> boolean isEmpty(T[] arr) {
        return null == arr || arr.length == 0;
    }
}

Related

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