Module jballerina.java.arrays

ballerina/jballerina.java.arrays Ballerina library

1.4.0

Overview

This module provides APIs to create new Java array instances, get elements from arrays, set elements, etc.

Create a Java array instance

Copy
handle stringClass = check java:getClass("java.lang.String");
handle StrArray = arrays:newInstance(stringClass, 4);

Get an element from a Java array

Copy
handle firstWord = arrays:get(words, 0);

Replace an element in a Java array

Copy
arrays:set(strArray, 0, java:fromString("Ballerina"));

Get Java array length

Copy
int length = arrays:getLength(array);

Get a Ballerina array from a Java array

Copy
int[] array = <int[]> check arrays:fromHandle(arrayHandle, "int");

Get a Java array from a Ballerina array

Copy
handle handleValue = check arrays:toHandle(bArray, "char");

Import

import ballerina/jballerina.java.arrays;Copy

Metadata

Released date: over 1 year ago

Version: 1.4.0

License: Apache-2.0


Compatibility

Platform: java17

Ballerina version: 2201.8.0

GraalVM compatible: Yes


Pull count

Total: 944

Current verison: 36


Weekly downloads


Source repository


Keywords

java

arrays


Contributors

Other versions

See more...