开发者

Xcode: Compare two NSMutableArrays

I have two NSMutableArrays(initialized from plist file contents) that contains Dictionary objects. Could anyone please help me with the best method开发者_高级运维 to achieve following result. The structure of Array is:

I want to compare two following arrays to get the old entries which is not exists in new array.

Old Array:

    <dict>
        <key>ResourceId</key>
        <string>352</string>
    </dict>

    <dict>
        <key>ResourceId</key>
        <string>3115</string>
    </dict> 

New Array:

    <dict>
        <key>ResourceId</key>
        <string>352</string>
    </dict>

    <dict>
        <key>ResourceId</key>
        <string>4629</string>
    </dict>

I want the resulted array contains following entry:

    <dict>
        <key>ResourceId</key>
        <string>3115</string>
    </dict>

Thanks.


Converting NSMutableArray to NSMutableSet objects and then using Intersect method should be the best one..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜