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

Suppose the following data schema: Usage ====== client_id resource type amount Billing ====== client_id
I have the following data structure (a list of lists) [ ['4', '21', '1',
Hi I have following data in the table: ID-----startDate----endDate 5549 2008-05-01 4712-12-31 5567 2008-04-17
I have following data to save in database using php my data is :
I have following data in my table. alt text http://img26.imageshack.us/img26/3746/productfield.png I want to extract
I have the following data: A post called Hello has categories greet Another post
Consider the following data structure: List<Person> People; class Person { List<Car> Cars; List<Hobby> Hobbies;
I have the following data | Item | Value | Date | ------------------------------ |
I have the following data in my database (comma separated strings): word, test, hello
I have the following data set that I am trying to plot with ggplot2,

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.