Posted By: arton Tajima
Date: 2011-07-18 14:06
Summary: Rjb-1.3.5 was released
Project: Ruby Java Bridge
Rjb-1.3.5 supports \'block as annoymous inner class\' like JRuby.
You may put block as the last interface argument.
For example java.util.Arrays.binarySearch takes 3 arguments : the array, the key and the comparator.
So you may write just:
Arrays = Rjb::import(\'java.util.Arrays\')
a = [0, 1, -2, 3, 4, -5]
p Arrays.binarySearch(a, -3) {|m, o1, o2| o1.abs - o2.abs } #=> 3
#-------
The arguments for the block is just as Object#method_missing. The first argument is Symbol of the method caller called, after the second argments are the method\'s original arguments.
Another new feature for Win64. JDK for Win64 only installs server VM for AMD64, so Rjb also loads server vm. (Win32 Rjb loads client or classic as it did before). |
|