1.1 --- a/CollectionUtils.m Tue Apr 15 18:02:40 2008 -0700
1.2 +++ b/CollectionUtils.m Fri May 02 12:49:43 2008 -0700
1.3 @@ -161,7 +161,9 @@
1.4
1.5
1.6
1.7 +
1.8 @implementation NSSet (MYUtils)
1.9 +
1.10 + (NSSet*) my_unionOfSet: (NSSet*)set1 andSet: (NSSet*)set2
1.11 {
1.12 if( set1 == set2 || set2.count==0 )
1.13 @@ -175,6 +177,19 @@
1.14 }
1.15 }
1.16
1.17 ++ (NSSet*) my_intersectionOfSet: (NSSet*)set1 andSet: (NSSet*)set2
1.18 +{
1.19 + if( set1 == set2 || set1.count==0 )
1.20 + return set1;
1.21 + else if( set2.count==0 )
1.22 + return set2;
1.23 + else {
1.24 + NSMutableSet *result = [set1 mutableCopy];
1.25 + [result intersectSet: set2];
1.26 + return [result autorelease];
1.27 + }
1.28 +}
1.29 +
1.30 + (NSSet*) my_differenceOfSet: (NSSet*)set1 andSet: (NSSet*)set2
1.31 {
1.32 if( set1.count==0 || set2.count==0 )
1.33 @@ -187,6 +202,7 @@
1.34 return [result autorelease];
1.35 }
1.36 }
1.37 +
1.38 @end
1.39
1.40