Follow-up Comment #1, bug #43915 (project gnustep): My solution for NSSet isEqualToSet: method. It looks ugly with introspection, because countForObject: methods is private for NSSet (or NSMutableSet) and is public for NSCountedSet in Apple implementation. It is possible to compare NSCountedSet and NSSet, the second one has count number equal 1 for all members. I have not tested it very carefully.
- (BOOL)isEqualToSet:(id)other { if ([self count] != [other count]) { return NO; } else { id object, enumerator = [self objectEnumerator]; BOOL isOtherCountedSet = [other isKindOfClass:[NSCountedSet class]]; BOOL isSelfCountedSet = [self isKindOfClass:[NSCountedSet class]]; while ((object = [enumerator nextObject])) { if (![other member: object]) { return NO; } NSUInteger countForObjectInOther = isOtherCountedSet ? [other countForObject:object] : 1; NSUInteger countForObjectInSelf = isSelfCountedSet ? [self countForObject:object] : 1; if (countForObjectInOther != countForObjectInSelf) { return NO; } } } return YES; } _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?43915> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-gnustep mailing list Bug-gnustep@gnu.org https://lists.gnu.org/mailman/listinfo/bug-gnustep