# Why Ruby Array does not get implicitly converted to Java Array?

**URL:** <https://www.ruby-forum.com/t/why-ruby-array-does-not-get-implicitly-converted-to-java-array/155707>\
**Category:** JRuby\
**Created:** [December 15, 2008, 7:40pm UTC](https://www.ruby-forum.com/t/why-ruby-array-does-not-get-implicitly-converted-to-java-array/155707 "2008-12-15T19:40:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergio\_Oliveira](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@Sergio\_Oliveira](https://www.ruby-forum.com/u/Sergio_Oliveira)\
**Post date:** [December 15, 2008, 7:40pm UTC](https://www.ruby-forum.com/t/why-ruby-array-does-not-get-implicitly-converted-to-java-array/155707/1 "2008-12-15T19:40:32Z")

</div>

This looks non-sense to me.

public static void printList(List list) {  
// print the list  
}

public static void printArray(String[] list) {  
// print the array  
}

From Ruby:

a = [“a”, “b”, “c”]

PrintUtils.printList(a); # Works fine!

PrintUtils.printArray(a); # Nasty error

PrintUtils.printArray(a.to\_java); # Nasty error

PrintUtils.printArray(a.to\_java(:String)); # Finally ok!

Why the hassle to implicitly convert a Ruby array to a Java array but no  
hassle to convert a Ruby array to a java.util.List ???

Just curious if this is by design (on purpose) or if it is something to  
be  
improved in the future (pending improvement).

Thanks,

-Sergio
