• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Creating a dictionary who's objects are also linked or indexed?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a dictionary who's objects are also linked or indexed?


  • Subject: Re: Creating a dictionary who's objects are also linked or indexed?
  • From: Aaron Jacobs <email@hidden>
  • Date: Sat, 12 Aug 2006 13:42:51 -0700

Honestly, I don't understand your first paragraph. But if it's saying the same thing as the second one, I guess you could make a category on NSArray with a method like itemsBetweenFirst:andSecond: that just returns an array with the items you are looking for using simple comparison on the receiver's own objects.

On Aug 12, 2006, at 12:00 PM, Phil wrote:

I'm curious if there is a better Cocoa solution than I've found to the following problem: I often have a list of items (strings, numbers, or dates) where I know the values of the first and last items and need to iterate over the inclusive set of items that fall between the first and last items. I can accomplish this by effectively implementing the lookup capability of a dictionary in an object contained in an array or by adding an index to an object in a dictionary. It can also be handled using Core Data which seems a lot like using a sledgehammer to swat a fly.

For example, I have a list of names and want to enumerate over the set of items from a given item to a given item. My code determines that "Ball" is the first value of interest and "Smith" is the last value, and given these, I need to return the inclusive set of items that fall between (simple alpha comparison) these values in the parent set.

It seems like a fairly common problem and am wondering if Cocoa provides a simpler solution that I'm not seeing?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Creating a dictionary who's objects are also linked or indexed? (From: Phil <email@hidden>)

  • Prev by Date: Re: Looking for networking guide
  • Next by Date: Re: Looking for networking guide
  • Previous by thread: Creating a dictionary who's objects are also linked or indexed?
  • Next by thread: Re: Creating a dictionary who's objects are also linked or indexed?
  • Index(es):
    • Date
    • Thread