adium 2438:2a6e8ec43901: Use distinctUnionOfObjects instead of u...
commits at adium.im
commits at adium.im
Mon Jun 1 17:59:13 UTC 2009
details: http://hg.adium.im/adium/rev/2a6e8ec43901
revision: 2438:2a6e8ec43901
author: Zachary West <zacw at adium.im>
date: Mon Jun 01 13:59:05 2009 -0400
Use distinctUnionOfObjects instead of unionOfObjects+iterating.
This came to me while not paying attention in class today.
diffs (21 lines):
diff -r 80efb0a2c258 -r 2a6e8ec43901 Source/NEHGrowlPlugin.m
--- a/Source/NEHGrowlPlugin.m Mon Jun 01 13:53:45 2009 -0400
+++ b/Source/NEHGrowlPlugin.m Mon Jun 01 13:59:05 2009 -0400
@@ -303,13 +303,10 @@
AIListObject *overallListObject = nil;
// If all events are from the same listObject, let's use that one in the message.
- for (AIListObject *listObject in [events valueForKeyPath:@"@unionOfObjects.AIListObject"]) {
- if (!overallListObject) {
- overallListObject = listObject;
- } else if (overallListObject != listObject) {
- overallListObject = nil;
- break;
- }
+ NSArray *listObjects = [events valueForKeyPath:@"@distinctUnionOfObjects.AIListObject"];
+
+ if (listObjects.count == 1) {
+ overallListObject = [listObjects objectAtIndex:0];
}
AILog(@"Posting multiple event - %@ %@ %@ %d", eventID, overallListObject, chat, events.count);
More information about the commits
mailing list