Unable to iterate over Java object properties using for (var p in object) construct

Walter Higgins walter.higgins at gmail.com
Sat Mar 8 21:25:12 UTC 2014


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?

-- 
Walter Higgins
Mobile: (+353) 086 8511600
Website: http://walterhiggins.net/


More information about the nashorn-dev mailing list