• 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: Asymmetrical behavior in NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Asymmetrical behavior in NSMutableArray


  • Subject: Re: Asymmetrical behavior in NSMutableArray
  • From: Justin Spahr-Summers <email@hidden>
  • Date: Thu, 10 Mar 2005 16:17:47 -0600

Just use the same method removeObject: does, except don't put it in a
loop. Attempt to find the index of the object, and use
removeObjectAtIndex:

On Thu, 10 Mar 2005 00:57:03 -0500, Serge Meynard <email@hidden> wrote:
> The behavior I want (or rather, the behavior I was *expecting*) is that
> if I add an object twice in an array, then I have to remove it twice
> also. Or more precisely, if object A is in the array (once) and I add
> it again, then remove it, it will still be there (once). I had objects
> showing up twice in my lists because of the order in which things were
> getting called in my code by Cocoa.
>
> I find it odd that addObject and removeObject: would behave differently
> when it comes to duplicates. It's not a huge concern, since I worked
> around the problem (for now anyway) by making sure I remove things
> *before* adding them again, and not the other way around. But it's not
> what I'd call intuitive behavior.
 _______________________________________________
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

  • Follow-Ups:
    • Re: Asymmetrical behavior in NSMutableArray
      • From: Guy English <email@hidden>
References: 
 >Asymmetrical behavior in NSMutableArray (From: Serge Meynard <email@hidden>)
 >Re: Asymmetrical behavior in NSMutableArray (From: Shawn Erickson <email@hidden>)
 >Re: Asymmetrical behavior in NSMutableArray (From: Serge Meynard <email@hidden>)

  • Prev by Date: evSpecialKeyMsg usage or alternative?
  • Next by Date: Re: Asymmetrical behavior in NSMutableArray
  • Previous by thread: Re: Asymmetrical behavior in NSMutableArray
  • Next by thread: Re: Asymmetrical behavior in NSMutableArray
  • Index(es):
    • Date
    • Thread