I have been tasked with "cleaning up" someone else's Objective-C code. I will admit, it is certainly not my favorite language.
One method i found in this user's code that seems redundant to me is this:
if (favoriteItemsArray || [favoriteItemsArray count] > 0) {
[favoriteItemsArray removeAllObjects];
favoriteItemsArray = nil;
}
if (favoriteOrderArray || [favoriteOrderArray count] > 0) {
[favoriteOrderArray removeAllObjects];
favoriteOrderArray = nil;
}
favoriteItemsArray = [[NSMutableArray alloc] init];
favoriteOrderArray = [[NSMutableArray alloc] init];
I wanted to double check with you all and see if i am just too use to JAVA, but couldn't this code be condensed to just the last two lines and just merely say:
favoriteItemsArray = [[NSMutableArray alloc] init];
favoriteOrderArray = [[NSMutableArray alloc] init];
If not can someone explain?
Again this is not my code..
ifstatements are bad. The||part is pointless.ifstatement? You don't show the closing curly brace.