nicklockwood / OrderedDictionary

This library provides OrderedDictionary and MutableOrderedDictionary subclasses.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

- (NSArray *)allValues not overridden

raphaeloliveira opened this issue · comments

Hey @nicklockwood, I think we need to override the - (NSArray *)allValues method to return them ordered. Right now, it's using the NSDictionary implementation where the order is not specified.

Are you sure about that? I thought the allValues array was created by calling objectForKey: for each key, so that order should match that of the allKeys array (AI could be wrong though - it's worth adding a unit test either way).

No, I'm not sure, I just realised the - (NSArray *)allValues wasn't being overridden and since we don't know Apple's implementation I decided to discuss with you if we should do it.

According to the documentation for the NSDictionary class cluster, you should only have to override count, objectForKey: and keyEnumerator. All the other default method implementations call those.

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html%23//apple_ref/occ/cl/NSDictionary

Cool, sorry for bothering you but at least I learned something new :). Thank you, I'll close the issue.