Is there a way to check if a set is empty?
NSMutableSet *setEmpty = [[NSMutableSet alloc] init];
// Code to do things...
// Check for empty set?
[setEmpty release];
gary
Is there a way to check if a set is empty?
NSMutableSet *setEmpty = [[NSMutableSet alloc] init];
// Code to do things...
// Check for empty set?
[setEmpty release];
gary
You can use [setEmpty count] to see how many elements are in the set... so:
if ([setEmpty count] == 0) {
or
if (![setEmpty count]) {
etc...
I didn't see an explicit 'isEmpty' method on http://developer.apple.com/mac/library/documentation/cocoa/Reference/Foundation/Classes/NSSet_Class/Reference/Reference.html but if it exists, go for that instead of checking the count.