Re: Most efficient way to iterate through an NSArray

2008-03-19 Thread Guido Neitzer
On 19.03.2008, at 12:52, Galen Rhodes wrote: The new way will fail too. It will throw a ConcurrentModificationException. If you think the array will change then best thing to do, if your working with NSArray, is to clone the array and then iterate over the clone like so: for(Obj

Re: Most efficient way to iterate through an NSArray

2008-03-19 Thread Galen Rhodes
The new way will fail too. It will throw a ConcurrentModificationException. If you think the array will change then best thing to do, if your working with NSArray, is to clone the array and then iterate over the clone like so: for(Object obj : myArray.immutableClone()) {

Re: Most efficient way to iterate through an NSArray

2008-03-19 Thread Guido Neitzer
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?

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread T Worman
My apps don't have any real problems. :-) Yeah, right. Good to know though. I am doing some batch fetching in certain places and I'm sure some future version of my apps could use tuning but I'm just glad I'm not handicapping anything too badly. Tim - Timothy Worman Programmer/Analyst Gr

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread Gaastra Dennis - WO Lists
Hi David, 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? With Kind Regards, Dennis Gaastra, M.B.A.[sfu

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread Anjo Krank
Ah, I misunderstood what Chuck was trying to say. Yes, this is fixed in Wonder (also for 5.3). And our toArray also works. Cheers, Anjo Am 17.03.2008 um 19:02 schrieb Anjo Krank: Correct, this was fixed a while ago, but toArray wasn't fixed. Am 17.03.2008 um 17:58 schrieb Chuck Hill: Yes,

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread David Avendasora
It's good to know this. I have just found myself using it a lot and wanted to know if I was doing things the right way or not. If you hadn't noticed, in the past, several of my practices were considered less than optimal. :-) I guess I now have reading to do on Batch Fetching... Dave On

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread Mr. Pierre Frisch
This is fixed in WO 5.4 Pierre -- Pierre Frisch [EMAIL PROTECTED] On Mar 17, 2008, at 9:55, David Avendasora wrote: I think I mis-spoke. It doesn't return an array of faults. If the relationship itself is a fault, simply calling products() without the .toArray() in a for loop returns a fau

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread Mike Schrag
Yeah ... +1 here. By far your performance problems are going to be inefficient use of EOF. For instance, if you're traversing relationships of relationships, you will want to make sure you have batch fetched them appropriately. See ERXRecursiveBatchFetching in Wonder. ms On Mar 17, 20

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread Chuck Hill
Enumeration should be slightly slower. But you are wasting your time looking at this to optimize your WO apps. Go find a real problem. Chuck On Mar 17, 2008, at 11:34 AM, Timmy wrote: All: How does java Enumeration compare to this with regard to performance? I iterate through my EO's

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread Timmy
All: How does java Enumeration compare to this with regard to performance? I iterate through my EO's almost always using Enumeration - um because that's how I was "learned." T - Programmer/Analyst Graduate School of Education and Information Studies University of California Los Angeles

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread Anjo Krank
Correct, this was fixed a while ago, but toArray wasn't fixed. Am 17.03.2008 um 17:58 schrieb Chuck Hill: Yes, that is a bug on NSArray (I think) that results in the fault not being fired if you call one of the Java collection methods. Which, of course, the new Java for loop calls. It is

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread Chuck Hill
Yes, that is a bug on NSArray (I think) that results in the fault not being fired if you call one of the Java collection methods. Which, of course, the new Java for loop calls. It is a Wonder, Wonderful WOrld. Chuck On Mar 17, 2008, at 9:55 AM, David Avendasora wrote: I think I mis-spoke

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread David Avendasora
I think I mis-spoke. It doesn't return an array of faults. If the relationship itself is a fault, simply calling products() without the .toArray() in a for loop returns a fault and trying to iterate over it doesn't work. At least this was the case in 5.3. I haven't tested it in 5.4. See th

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread Chuck Hill
On Mar 17, 2008, at 3:41 AM, David Avendasora wrote: Hi all, I find myself often times needing to iterate through an NSArray of EOs. I'm not sure if the way I'm doing it is the most effecient or not. Here's what I normally do: public void doThisForAllProducts(EOEditingContext ec) {

Re: Most efficient way to iterate through an NSArray

2008-03-17 Thread Alexander Spohr
Hey David. Am 17.03.2008 um 11:41 schrieb David Avendasora: I find myself often times needing to iterate through an NSArray of EOs. I'm not sure if the way I'm doing it is the most effecient or not. Here's what I normally do: public void doThisForAllProducts(EOEditingContext ec) {

Most efficient way to iterate through an NSArray

2008-03-17 Thread David Avendasora
Hi all, I find myself often times needing to iterate through an NSArray of EOs. I'm not sure if the way I'm doing it is the most effecient or not. Here's what I normally do: public void doThisForAllProducts(EOEditingContext ec) { for (Object aProductObject : products().toArray()) {