generic method to check if an array is null or its length is 0 - Android java.lang

Android examples for java.lang:Array Element

Description

generic method to check if an array is null or its length is 0

Demo Code


//package com.java2s;

public class Main {
    /**/*from w ww  .j a  v a2s  .c o  m*/
     * is null or its length is 0
     * 
     * @param <V>
     * @param sourceArray
     * @return
     */
    public static <V> boolean isEmpty(V[] sourceArray) {
        return (sourceArray == null || sourceArray.length == 0);
    }
}

Related Tutorials