Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6602979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:56:43+00:00 2026-05-25T18:56:43+00:00

The following data: sku=[111222] is being passed in as an argument to a javascript

  • 0

The following data:

sku=[111222]

is being passed in as an argument to a javascript function being invoked in the Rhino javascript engine.

On the java side (where the data originates) this means that a String key of “sku” is mapped to an ArrayList with one String “111222” inside it.

Once this goes over to the Rhino side, I have no idea how to make use of this as a javascript object. For example: How do I even do something as simple as fetching the 111222 value on the JS side?

I decided to spit out what a key/value dump of this object looked like on the JS side and this is what I got:

sku=

empty: false

indexOf: function indexOf() {/*
int indexOf(java.lang.Object)
*/}

notifyAll: function notifyAll() {/*
void notifyAll()
*/}

removeAll: function removeAll() {/*
boolean removeAll(java.util.Collection)
*/}

trimToSize: function trimToSize() {/*
void trimToSize()
*/}

containsAll: function containsAll() {/*
boolean containsAll(java.util.Collection)
*/}

contains: function contains() {/*
boolean contains(java.lang.Object)
*/}

equals: function equals() {/*
boolean equals(java.lang.Object)
*/}

notify: function notify() {/*
void notify()
*/}

subList: function subList() {/*
java.util.List subList(int,int)
*/}

class: class java.util.ArrayList
set: function set() {/*
java.lang.Object set(int,java.lang.Object)
*/}

isEmpty: function isEmpty() {/*
boolean isEmpty()
*/}

add: function add() {/*
void add(int,java.lang.Object)
boolean add(java.lang.Object)
*/}

ensureCapacity: function ensureCapacity() {/*
void ensureCapacity(int)
*/}

size: function size() {/*
int size()
*/}

iterator: function iterator() {/*
java.util.Iterator iterator()
*/}

clear: function clear() {/*
void clear()
*/}

wait: function wait() {/*
void wait()
void wait(long)
void wait(long,int)
*/}

listIterator: function listIterator() {/*
java.util.ListIterator listIterator(int)
java.util.ListIterator listIterator()
*/}

retainAll: function retainAll() {/*
boolean retainAll(java.util.Collection)
*/}

toString: function toString() {/*
java.lang.String toString()
*/}

hashCode: function hashCode() {/*
int hashCode()
*/}

toArray: function toArray() {/*
java.lang.Object[] toArray(java.lang.Object[])
java.lang.Object[] toArray()
*/}

lastIndexOf: function lastIndexOf() {/*
int lastIndexOf(java.lang.Object)
*/}

addAll: function addAll() {/*
boolean addAll(java.util.Collection)
boolean addAll(int,java.util.Collection)
*/}

clone: function clone() {/*
java.lang.Object clone()
*/}

get: function get() {/*
java.lang.Object get(int)
*/}

getClass: function getClass() {/*
java.lang.Class getClass()
*/}

remove: function remove() {/*
java.lang.Object remove(int)
boolean remove(java.lang.Object)
*/}

Can anyone tell me how to work with such objects in rhino javascript engine?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:56:43+00:00Added an answer on May 25, 2026 at 6:56 pm

    The JavaScript program is receiving a Java ArrayList; this is why the above dump matches the API of java.util.ArrayList. (See the Java API documentation.) You can call the Java methods of that Java object relatively transparently from your JavaScript code. So, for example, to loop through the elements of the array you are receiving:

    var sku = [however you are getting it];
    for (var i=0; i<sku.size(); i++) {
        var nextElement = sku.get(i);
        // do something
    }
    

    Caveat: Assuming the ArrayList is created on the Java side and is creating Java objects, the algorithm above will put a Java java.lang.String into the nextElement variable. This object may behave strangely if your application is JavaScript-centric (for example, typeof(nextElement) == "object" /* not "string" */). If you want a JavaScript string, you’ll need to convert it; the easiest way is String(nextElement).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following data in a JS script: $(#holdSave).live('click', function () { var
Say I have the following data IEnumerable<IEnumerable<int>> items = new IEnumerable<int>[] { new int[]
I have the following data inside an NSData object: <00000000 6f2d840e 31504159 2e535953 2e444446
I have following data frames > head(elo) date elo 1 1921-12-18 1597 2 1922-05-14
So I have the following data that represets the hour and quarter hour with
I have the following data from 2 tables Notes (left) and scans (right) :
I have the following data X Y INFTIME 1 1 0 1 2 4
I have the following data structure: P_ID EVSSMIN EVSSMAX TDMIN TDMAX WARD SYRINGE_ID COMBINE_WITH
I have the following data: <media:group> <media:content url=http://www.url.com bitrate=450 width=320 duration=32 /> <media:content url=http://www.url.com
I have the following data structure (an atomic vector?) output from daply in plyr

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.