Java Array Empty Check isEmpty(T[] array)

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

Description

is Empty

License

Apache License

Declaration

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

Method Source Code


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

import java.util.Collection;

public class Main {
    public static <T> boolean isEmpty(Collection<? extends T> collection) {
        return size(collection) == 0;
    }//from  w  ww  .ja  va  2  s.  co m

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

    public static int size(Collection<?> collection) {
        return collection != null ? collection.size() : 0;
    }

    public static <T> int size(T[] array) {
        return array == null ? 0 : array.length;
    }
}

Related

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