Working with arrays

Data structures are one of the essential aspects of every piece of software. Any application, from simple command line util to scalable enterprise systems, constantly process various information, that very often require specific grouping and access strategies. This aspect is addressed by arrays and more advanced collection types. By using the Javonet framework, users gain ability to easily and effectively work with data structures originating from any runtime.

This article provides an introduction to cross-technology handling of arrays from any runtime using any language. The article explains how to work with arrays between calling and called technology.
With Javonet you can interact with arrays from any runtime like they were available in any language but invocation must be performed through Javonet SDK API.

Working with arrays custom any runtime

With Javonet it is possible to reference any custom any runtime and interact with arrays declared on types defined within that module almost the same as with any other any language library.

This section present sample custom any runtime with class declaring method which returns array and Javonet SDK syntax required to use that array and consume the results in any language.

Code example below represents the sample code from any runtime that will be used in following sections.

It is possible to invoke method which returns array from any runtime using following any language code. This uses in memory runtime bridging to load the any runtime, and next retrieves reference to specific type, create object of the type, and invoke method which returns array. Result of the invocation is returned as a reference to the array.

Get element of the array

Select technology of module you want to use:

Set element of the array

Select technology of module you want to use:

Get size of the array

Select technology of module you want to use:

Iterate over the array

Select technology of module you want to use:

Pass array as argument

Select technology of module you want to use:

Retrieve array

Select technology of module you want to use:

Optional [] Operator

For technologies which supports operator overloading it is possible to use array's [] operator as for any other any language array:

Select technology of module you want to use:

And

Select technology of module you want to use: