On Jul 7, 2:56 am, Attila Szegedi <[email protected]> wrote:
> I have a homegrown WrapFactory for that. You can find the code at 
> <http://markmail.org/message/xkmxywud3dgzfqlw>
>
> A word of caution though: it will expose indexed access through the [] 
> operator and for...in, as well as the .length property, but will not make the 
> java.util.Lists otherwise act as arrays. i.e. they'll have no .forEach() and 
> other methods. You could *probably* create a solution where the lists also 
> get the Array.prototype as their prototype; not 100% sure about it though...
>
> Attila.
>

RingoJS has a very handy ScriptableList and ScriptableMap.  The
ScriptableList wraps a java List and gets the Array.prototype so you
can use push, slice, etc.

http://github.com/ringo/ringojs/blob/master/src/org/ringojs/wrappers/ScriptableList.java
http://github.com/ringo/ringojs/blob/master/src/org/ringojs/wrappers/ScriptableMap.java

Kevin
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to