Utilities to convert Collections to JS arrays

20 views
Skip to first unread message

Will Shulman

unread,
Oct 1, 2011, 7:06:15 PM10/1/11
to RingoJS
Are there any ringo utilities to convert Java Collections into JS
arrays?

thanks
-will

Robert Thurnher

unread,
Oct 1, 2011, 8:00:36 PM10/1/11
to rin...@googlegroups.com
On 2 October 2011 01:06, Will Shulman <wi...@objectlabs.com> wrote:
> Are there any ringo utilities to convert Java Collections into JS
> arrays?

Array comprehensions[1] come in handy for such conversions.

Example:

https://gist.github.com/1256833

[1]: http://mzl.la/rbhokM

-- Robi


> thanks
> -will
>

Robert Thurnher

unread,
Oct 1, 2011, 9:15:28 PM10/1/11
to rin...@googlegroups.com

Additionally, Ringo's got `Scriptable[List|Map]` mirroring Java
collections to their respective JS counterparts.

Here're some more examples -- also showing that Rhino's JS arrays
implement `java.util.List` as well as its JS objects implement
`java.util.Map` interfaces and how this can be useful:

https://gist.github.com/1256910

HTH.

-- Robi


>
>> thanks
>> -will
>>
>

McKinley

unread,
Oct 1, 2011, 11:11:16 PM10/1/11
to rin...@googlegroups.com
I had success with http://documentcloud.github.com/underscore/ for converting and wrapping up Java collections.

Cheers,

McKinley

Will Shulman

unread,
Oct 2, 2011, 12:38:09 PM10/2/11
to RingoJS
All good resources - really helpful, thanks a lot guys!

-will

On Oct 1, 8:11 pm, McKinley <mckinley1...@gmail.com> wrote:
> I had success withhttp://documentcloud.github.com/underscore/for
> converting and wrapping up Java collections.
>
> Cheers,
>
> McKinley
>
> On Sat, Oct 1, 2011 at 6:15 PM, Robert Thurnher <r.thurn...@gmail.com>wrote:
>
>
>
>
>
>
>
> > On 2 October 2011 02:00, Robert Thurnher <r.thurn...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages