Is there a simpler way to access Java arrays?

Post your questions and help other users.

Moderator: Martin

jaejunks
Posts: 13
Joined: 03 Apr 2018 13:31

Re: Is there a simpler way to access Java arrays?

Post by jaejunks » 27 Apr 2018 19:21

Oh, I didn't know that `int` is acceptable for Java arguments. Thanks for the correction.

I was under the impression that Java arguments must be specified using fully qualified class names. e.g. `java.lang.Object`, `java.lang.String`, etc. But I guess I was mistaken. I'm not familiar with Java, you see...

The main reason why I need this is when working with long arrays where I already know which element index I need to retrieve. e.g. last 3 elements. I can use for-each loop to retrieve the first 3 elements efficiently, but not the last 3 elements because I have to iterate the whole array.

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Is there a simpler way to access Java arrays?

Post by bogdyro » 27 Apr 2018 20:53

It's not me that changed the parameters. Automagic fills them in. It's weird that they're not the same for both of us. Anyway, glad it works.

jaejunks
Posts: 13
Joined: 03 Apr 2018 13:31

Re: Is there a simpler way to access Java arrays?

Post by jaejunks » 28 Apr 2018 02:18

What do you mean by "Automagic filled them in"?

I mean, where did you find that `int`? Cause the code in my Script action doesn't get corrected by Automagic. I type the `get()` arguments manually, and there's no underlining hint when the cursor is within the `methodSignature` argument's value, because that argument is a string. I don't see any hint in the flow log either.

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Is there a simpler way to access Java arrays?

Post by bogdyro » 28 Apr 2018 07:51

Well..you shouldn't do it this way.
You use the function button in the bottom of the script window. You type in the desired Java function and you get the screen where you choose the class and function.
And the parameters get filled in automagically

jaejunks
Posts: 13
Joined: 03 Apr 2018 13:31

Re: Is there a simpler way to access Java arrays?

Post by jaejunks » 28 Apr 2018 11:31

Oh, I didn't know that Java related functions have additional dialogs. That's sure is useful. I thought the Function button simply generates the function call template like most other functions do.

Thanks for explaining that.

Post Reply