2

How to create nested arrays using gwt JsArray.

1 Answer 1

4

The same way you create a nested Collection in Java, you can create a nested JsArray:

    JsArray<JsArray<JavaScriptObject>> myArray = JavaScriptObject.createArray().cast();
    for (int i = 0; i < 5; i++) {

        JsArray<JavaScriptObject> innerArray = JavaScriptObject.createArray().cast();
        for (int j = 0; j < 3; j++) {
            innerArray.push(JavaScriptObject.createObject());
        }
        myArray.push(innerArray);
    }
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks You very much I was looking for this for a long time

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.