Hi Jochen,

How about:

lookup.findStatic(Array.class, "getLength", methodType(int.class, Object.class))

(java.lang.reflect.Array)

That's what we use in Golo to provide "length/size" methods to arrays, e.g.:

  let a = [1, 2, 3]
  println(a: length())

- Julien

> On 09 Jan 2015, at 12:05, Jochen Theodorou <blackd...@gmx.org> wrote:
> 
> Hi,
> 
> is there a way to get the length of an array using method handles? Of course 
> I can write a small method to do that, but given the multitude of primitive 
> types this means a lot of small methods. So I was wondering if there is a 
> more elegant but still fast solution
> 
> bye Jochen
> 
> -- 
> Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
> blog: http://blackdragsview.blogspot.com/
> german groovy discussion newsgroup: de.comp.lang.misc
> For Groovy programming sources visit http://groovy-lang.org
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JVM Languages" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jvm-languages+unsubscr...@googlegroups.com.
> To post to this group, send email to jvm-languages@googlegroups.com.
> Visit this group at http://groups.google.com/group/jvm-languages.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jvm-languages+unsubscr...@googlegroups.com.
To post to this group, send email to jvm-languages@googlegroups.com.
Visit this group at http://groups.google.com/group/jvm-languages.
For more options, visit https://groups.google.com/d/optout.

Reply via email to