一维数组
if(array == null || array.length == 0) return false;
二维数组
if((array==null||array.length==0)||(array.length==1&&array[0].length==0))return false;
array==null:数组为空
array.length==0:行为0,即 array = {}
array.length==1 && array[0].length == 0:行为1,列为0,即 array = {{}}
if(array == null){
return false;
}
int rows = array.length;
int cols = array[0].length;
if(rows<=0 || cols<= 0){
return false;
}
二维数组终极版:
if(array == null || array.length <= 0 || array[0].length <=0) return false ;