diff -r c9f2e0c7359a -r 59addced5e2a CollectionUtils.m --- a/CollectionUtils.m Tue Apr 15 18:02:40 2008 -0700 +++ b/CollectionUtils.m Fri May 02 12:49:43 2008 -0700 @@ -161,7 +161,9 @@ + @implementation NSSet (MYUtils) + + (NSSet*) my_unionOfSet: (NSSet*)set1 andSet: (NSSet*)set2 { if( set1 == set2 || set2.count==0 ) @@ -175,6 +177,19 @@ } } ++ (NSSet*) my_intersectionOfSet: (NSSet*)set1 andSet: (NSSet*)set2 +{ + if( set1 == set2 || set1.count==0 ) + return set1; + else if( set2.count==0 ) + return set2; + else { + NSMutableSet *result = [set1 mutableCopy]; + [result intersectSet: set2]; + return [result autorelease]; + } +} + + (NSSet*) my_differenceOfSet: (NSSet*)set1 andSet: (NSSet*)set2 { if( set1.count==0 || set2.count==0 ) @@ -187,6 +202,7 @@ return [result autorelease]; } } + @end