I use loops like this a lot in WO 5.3 on Mac OS X 10.4.8 with Java 1.5:
NSArray people = thing.toPeople();
for (Person person : (List<Person>)people) {
...
}
I have found that in certain cases, if I don't have the separate
array, the loop will not be executed:
for (Person person : (List<Person>)thing.toPeople()) {
...
}
Sometimes it even needs something like
people.count();
before the loop to make it run the loop. But it is not intermittent--
in any particular code it either works or doesn't.
On 23/03/2007, at 3:34, Francis Labrie wrote:
It seems faults are fired on toArray(), objects() and mutableClone
() NSArray interface calls. So preliminary tests seems to allow
Java 5 enhanced for loop usage like this:
for(Object object : object.toManyRelationship().toArray()) {
...
}
Unfortunately, WebObjects classes dont use generics, so you still
have to type cast objects. :-(
Can someone confirms that using Java 5 enhanced loop in that way is
safe?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]