You can also use pattern matching in the newer versions if(array is null or [])
if(array is null or [])