|
|
|
|
|
by pmr_
4090 days ago
|
|
if( masterList[z].list2 != NULL && masterList[z].list2.length() > 0 )
{
for( Integer y = 0; y < masterList[z].list2.length(); y++ )
The if-statement is a good summary of what is wrong with Java. The author doesn't even notice that the second argument of && is redundant and keeps it in the "refactored" version as well... |
|
That's false. A list object may be initialized but be empty (making it's length zero). Or it may not be initialized (making it null).
Both conditions may happen independently of one another. He checks for the null first so that checking the length does not throw a NPE.
> The if-statement is a good summary of what is wrong with Java.
Frankly, I see nothing wrong here.