• 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: Most efficient way to iterate through an NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Most efficient way to iterate through an NSArray


  • Subject: Re: Most efficient way to iterate through an NSArray
  • From: Guido Neitzer <email@hidden>
  • Date: Wed, 19 Mar 2008 12:17:04 -0600

On 17.03.2008, at 14:28, Gaastra Dennis - WO Lists wrote:

This is how we are retrofitting most of our array loops; now since WO 5.4:

public void doThisForAllProducts(EOEditingContext ec) {
	for (Product aProduct : products())
		aProduct.doThis(ec);
}

Nice and simple, eh?

What if someone changes your array while you're working on it? I don't know what this new style will produce, but the very old style with:


for (int i = 0; i < array.count(); i++) {
	// do something
}

could fail if someone changed the relationship behind your back.

cug

--
http://www.event-s.net

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Most efficient way to iterate through an NSArray
      • From: Galen Rhodes <email@hidden>
References: 
 >Most efficient way to iterate through an NSArray (From: David Avendasora <email@hidden>)
 >Re: Most efficient way to iterate through an NSArray (From: Gaastra Dennis - WO Lists <email@hidden>)

  • Prev by Date: Re: NEVER MIND Re: Can't start.. get this error..
  • Next by Date: Re: Most efficient way to iterate through an NSArray
  • Previous by thread: Re: Most efficient way to iterate through an NSArray
  • Next by thread: Re: Most efficient way to iterate through an NSArray
  • Index(es):
    • Date
    • Thread