Java Utililty Methods Array Empty Check

List of utility methods to do Array Empty Check

Description

The list of methods to do Array Empty Check are organized into topic(s).

Method

booleanareArraysEqual(byte[] arr1, byte[] arr2, boolean dontDistinctNilAndEmpty)
are Arrays Equal
if (!dontDistinctNilAndEmpty)
    return Arrays.equals(arr1, arr2);
if (arr1 == null || arr1.length == 0)
    return arr2 == null || arr2.length == 0;
return Arrays.equals(arr1, arr2);
Object[][]getNonemptySubsets(Object[] objects)
Gets all non-empty subsets of the given array of objects.
Object[][] subsets = getAllSubsets(objects);
Object[][] nonempty = new Object[subsets.length - 1][];
for (int i = 0; i < nonempty.length; i++)
    nonempty[i] = subsets[i + 1];
return nonempty;
String[]getWithoutEmptyParams(String[] cmdarray)
get Without Empty Params
if (cmdarray == null) {
    return null;
ArrayList<String> list = new ArrayList<String>();
for (String string : cmdarray) {
    if (string != null && string.length() > 0) {
        list.add(string);
return list.toArray(new String[list.size()]);
booleanhasOneEmpty(String[] args)
has One Empty
if (args == null)
    return false;
for (int i = 0; i < args.length; i++) {
    if (isEmpty(args[i]))
        return true;
return false;
booleanisEmpty(boolean[] values)
is Empty
return values == null || values.length == 0;
booleanisEmpty(byte[] array)
is Empty
byte[] empty = new byte[array.length];
return Arrays.equals(array, empty);
booleanisEmpty(E[] array)
is Empty
return (array == null || array.length == 0);
booleanisEmpty(final int[] arr)
is Empty
return arr.length == 0;
booleanisEmpty(final Object[] array)
Is the given array null or empty ?
return array == null || array.length == 0;
booleanisEmpty(final X[] array)
is Empty
return (isNull(array) || 0 == array.length);