• 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: Searching dictionaries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searching dictionaries


  • Subject: Re: Searching dictionaries
  • From: Bill Cheeseman <email@hidden>
  • Date: Sat, 11 Oct 2003 06:43:54 -0400

on 03-10-10 11:37 PM, April Gendill at email@hidden wrote:

> I have a data structure. The root is a dictionary which contains
> string items and other dictionaries (possibly nested). I tried
> enumerating the dictionary but I cannot remove an item or other wise
> use it because the enumerator only provides either a string or
> dictionary object.

Once you solve the problem of enumerating the dictionary, you will have to
face the documented fact that you should never remove objects from a
collection while enumerating it (using NSEnumerator). You cannot work around
this issue by using a reverse enumerator, because the issue is not a matter
of keeping the indexes straight.

Often the easiest way to do this is to use the enumerator to construct a
separate, temporary collection of the items to be removed (or their
indexes), then remove the identical items from the original collection.

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Searching dictionaries (From: April Gendill <email@hidden>)

  • Prev by Date: Re: NSTimer - crash when closing window
  • Next by Date: Re: NSTimer - crash when closing window
  • Previous by thread: Re: Searching dictionaries
  • Next by thread: Re: Searching dictionaries
  • Index(es):
    • Date
    • Thread