C
C
Chvalov2015-11-12 05:24:30
Java
Chvalov, 2015-11-12 05:24:30

How to check an entire array for null?

For example, there is a string arrayString[] test;

if (test[] == null){
    Log.e("NULL - ", " ДА");
  } else {
    Log.e("NULL", "НЕТ");
  }
And it will give out that it is not null, while if you look in debag then there All elements are null
How to actually check an array for null ??
As I understand it, you can check only for some index for null or go through all the indices in a loop with a check for null, but is there a more normal way to check an array for null without a loop and a specific index?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
moryakov, 2015-11-12
@Chvalov

How to check many variables for null?

I
Ildar Gafarov, 2015-11-12
@badprogrammist

Well, there is a difference between a single null reference and an array containing null references. Read more here stackoverflow.com/questions/2369967/how-we-check-f...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question