Here you can find the source of isEmpty(Object[] array)
Checks if an array of Objects is empty or null
.
Parameter | Description |
---|---|
array | the array to test |
true
if the array is empty or null
public static boolean isEmpty(Object[] array)
//package com.java2s; /**/* ww w . j a v a2 s . co m*/ * Copyright (c) 2005-2012 springside.org.cn * * Licensed under the Apache License, Version 2.0 (the "License"); */ import java.util.Collection; import java.util.Map; public class Main { public static boolean isEmpty(Collection collection) { return (collection == null || collection.isEmpty()); } /** * <p>Checks if an array of Objects is empty or <code>null</code>.</p> * * @param array the array to test * @return <code>true</code> if the array is empty or <code>null</code> * @since 2.1 */ public static boolean isEmpty(Object[] array) { if (array == null || array.length == 0) { return true; } return false; } /** * <p>Checks if an array of primitive longs is empty or <code>null</code>.</p> * * @param array the array to test * @return <code>true</code> if the array is empty or <code>null</code> * @since 2.1 */ public static boolean isEmpty(long[] array) { if (array == null || array.length == 0) { return true; } return false; } /** * <p>Checks if an array of primitive ints is empty or <code>null</code>.</p> * * @param array the array to test * @return <code>true</code> if the array is empty or <code>null</code> * @since 2.1 */ public static boolean isEmpty(int[] array) { if (array == null || array.length == 0) { return true; } return false; } /** * <p>Checks if an array of primitive shorts is empty or <code>null</code>.</p> * * @param array the array to test * @return <code>true</code> if the array is empty or <code>null</code> * @since 2.1 */ public static boolean isEmpty(short[] array) { if (array == null || array.length == 0) { return true; } return false; } /** * <p>Checks if an array of primitive chars is empty or <code>null</code>.</p> * * @param array the array to test * @return <code>true</code> if the array is empty or <code>null</code> * @since 2.1 */ public static boolean isEmpty(char[] array) { if (array == null || array.length == 0) { return true; } return false; } /** * <p>Checks if an array of primitive bytes is empty or <code>null</code>.</p> * * @param array the array to test * @return <code>true</code> if the array is empty or <code>null</code> * @since 2.1 */ public static boolean isEmpty(byte[] array) { if (array == null || array.length == 0) { return true; } return false; } /** * <p>Checks if an array of primitive doubles is empty or <code>null</code>.</p> * * @param array the array to test * @return <code>true</code> if the array is empty or <code>null</code> * @since 2.1 */ public static boolean isEmpty(double[] array) { if (array == null || array.length == 0) { return true; } return false; } /** * <p>Checks if an array of primitive floats is empty or <code>null</code>.</p> * * @param array the array to test * @return <code>true</code> if the array is empty or <code>null</code> * @since 2.1 */ public static boolean isEmpty(float[] array) { if (array == null || array.length == 0) { return true; } return false; } /** * <p>Checks if an array of primitive booleans is empty or <code>null</code>.</p> * * @param array the array to test * @return <code>true</code> if the array is empty or <code>null</code> * @since 2.1 */ public static boolean isEmpty(boolean[] array) { if (array == null || array.length == 0) { return true; } return false; } public static boolean isEmpty(Map map) { if (map == null || map.size() == 0) { return true; } return false; } }