Java Array Has arrayHasContent(Object[] array)

Here you can find the source of arrayHasContent(Object[] array)

Description

Helper method to determine whether an array has any content.

License

Open Source License

Parameter

Parameter Description
array the array

Return

true if the array is non-null and has a length other than 0

Declaration

public static boolean arrayHasContent(Object[] array) 

Method Source Code

//package com.java2s;
// compliance with the InfoGrid license. The InfoGrid license and important

public class Main {
    /**//from   w  ww .j a v  a  2s  .com
     * Helper method to determine whether an array has any content.
     *
     * @param array the array
     * @return true if the array is non-null and has a length other than 0
     */
    public static boolean arrayHasContent(Object[] array) {
        if (array != null) {
            for (int i = 0; i < array.length; ++i) {
                if (array[i] != null) {
                    return true;
                }
            }
        }
        return false;
    }
}

Related

  1. arrayHas(int[] arr, int val)
  2. arrayHasContiguousRowEntries(double[] aVector)
  3. arrayHasElements(Object[] obj)
  4. arrayHasTaints(int[] a)
  5. inArray(byte needle, byte[] haystack)