Avoid using in for non-sparse arrays in all()