Request for review 7147066: [macosx] FileDialog.getDirectory() returns incorrect directory
Mike Swingler
swingler at apple.com
Thu Mar 1 09:09:13 PST 2012
On Feb 29, 2012, at 3:49 PM, Dmitry Cherepanov wrote:
> Mike Swingler wrote:
>> On Feb 28, 2012, at 2:01 PM, Dmitry Cherepanov wrote:
>>
>>> Mike Swingler wrote:
>>> Here's new webrev - http://cr.openjdk.java.net/~dcherepanov/7147066/webrev.1/
>>
>> Looks great. I probably should have also mentioned that you can use NSArray iteration syntax too:
>> for (id item in array) { }
>
> We use the array index within the loop and the loop would look like:
>
> for (id item in array){
> i = [array indexOfObject:item];
> (*env)->SetObjectArrayElement(env, returnValue, i, filename);
> }
>
> This way (with the indexOfObject:) might seem to be more costly rather than incrementing a variable, isn't it?
Of course, I didn't see that. Obviously the "i" is required to inject into the JNI array.
You could use the block-based enumeration, but that's probably just more verbose:
[array enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop){ ... }
Regards,
Mike Swingler
Apple Inc.
More information about the macosx-port-dev
mailing list