Java Array Empty Check isEmpty(int[] array)

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

Description

is Empty

License

Open Source License

Declaration

public static boolean isEmpty(int[] array) 

Method Source Code

//package com.java2s;
/*//from   w w  w .  j  a  va  2 s .c o m
 * Copyright 2009-2012 Evun Technology. 
 * 
 * This software is the confidential and proprietary information of
 * Evun Technology. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with evun.cn.
 */

import java.util.Collection;

import java.util.Map;

public class Main {

    public static boolean isEmpty(Collection collection) {
        return (collection == null || collection.isEmpty());
    }

    /**
     * Return <code>true</code> if the supplied Map is <code>null</code> or
     * empty. Otherwise, return <code>false</code>.
     * 
     * @param map
     *            the Map to check
     * @return whether the given Map is empty
     */
    public static boolean isEmpty(Map map) {
        return (map == null || map.isEmpty());
    }

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

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

    /**
     * <p>
     * Checks if an array of primitive bytes is empty or {@code null}.
     * </p>
     *
     * @param array
     *            the array to test
     * @return {@code true} if the array is empty or {@code null}
     * @since 2.1
     */
    public static boolean isEmpty(byte[] array) {
        return array == null || array.length == 0;
    }
}

Related

  1. isEmpty(E[] array)
  2. isEmpty(final int[] arr)
  3. isEmpty(final Object[] array)
  4. isEmpty(final X[] array)
  5. isEmpty(int[] array)
  6. isEmpty(Object[] args)
  7. isEmpty(Object[] arr)
  8. isEmpty(Object[] array)
  9. isEmpty(Object[] array)