pulling unique values from an array of custom objects

后端 未结 1 1275
挽巷
挽巷 2021-01-28 06:23

i have an array list of custom objects. each object contains a value i need to pull out, claimNO, but is not a unique value, meaning say 5 objects may have the same claimNO.

相关标签:
1条回答
  • 2021-01-28 06:55

    Couple points, for the objectForKey, check for nil to determine the absence of the key.

    Also, you could just drop the array of claims into an NSSet that seems to closer to the desired behavior. But I am unsure, if you want to just access one or all of the claims for any given claim number.

    I think design wise what you are doing will work, but generalize your claim class to include all the claims for any given claim number. Keep you dictionary and the claim number key will access all of the given claims attached to a unique claim number.

    0 讨论(0)
提交回复
热议问题