logo       

Re: [jruby-user] Creating Java arrays: msg#00158

lang.jruby.user

Subject: Re: [jruby-user] Creating Java arrays

Ah, Matt's answer was what I was looking for...I had no idea how to
specify the type of the array to be created, particularly when that
type was a primitive type. (Somehow I'd completely missed the Wiki,
too...oops.) Thanks!

On Nov 18, 2007 10:31 AM, Matt Fletcher <fletcher@xxxxxxxxxxxxxxxx> wrote:
> It took me a while to find this as well. I think I eventually got my answer
> from the JRuby Cookbook pages on the wiki.
>
> Anyway, try this:
> ["a", "b", "c"].to_java(:String)
>
> The parameter you give to to_java is the Java type you want the Java array
> to be.
>
>
>
> On 11/18/07, Scott Davies <scottd@xxxxxxxxx> wrote:
> >
> >
> >
> > Simple JRuby newbie question: how do you create a Java array of a
> > particular Java type in JRuby? I haven't seen any mention of this in
> > the docs I've managed to find, and trying to search over the mailing
> > list archive on Codehaus currently makes the site barf ("application
> > error").
> >
> > Thanks,
> >
> > -- Scott
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> > http://xircles.codehaus.org/manage_email
> >
> >
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise