Iterating properties of java objects - both fields, methods - is a rhino specific feature. This is not supported by nashorn. If you've a java array or Iterable, JS for and for..each will do the expected - namely iterate over the array/collection.

Thanks
-Sundar


On Sunday 09 March 2014 02:55 AM, Walter Higgins wrote:
In Java 7 I can iterate over the properties/methods of a Java object using
this notation...

for (var p in javaObject) {
   print(p);
}

In java 8 this no longer works.

for (var p in javaObject) {
   print(p);
}

...doesn't result in the for loop block being executed (there are no
properties).

How can I iterate over the Java object properties in a consisted way
between Java 6, 7 and 8?


Reply via email to