1

How can I specify Java primitive array?

Java Object array type can be specified like

['a'].to_java(:string).is_a? java.lang.String[] -> true

but I don't know how to pass Java primitive array class.

[1].to_java(:byte).is_a? ???

[1].to_java(:byte).is_a? byte[] NameError: undefined local variable or method `byte' for main:Object

[1].to_java(:byte).is_a? :'byte[]' TypeError: class or module required

[1].to_java(:byte).is_a? java.lang.byte[] ArgumentError: illegal package name component: byte

What is a JRuby type of java primitive array type?

1 Answer 1

2

I found an answer.

[1].to_java(:byte).is_a?([].to_java(:byte).class) -> true

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.