@ Override protected Iterator < ? > getJavaIterator ( Context cx , Scriptable scope , Object obj ) { if ( obj instanceof Wrapper ) { Object unwrapped = ( ( Wrapper ) obj ) . unwrap ( ) ; Iterator < ? > iterator = null ; if ( unwrapped instanceof Iterator ) iterator = ( Iterator < ? > ) unwrapped ; if ( unwrapped instanceof Iterable ) iterator = ( ( Iterable < ? > ) unwrapped ) . iterator ( ) ; return iterator ; } return null ; }
If obj is a java . util . Iterator or a java . lang . Iterable return a wrapping as a JavaScript Iterator . Otherwise return null . This method is in VMBridge since Iterable is a JDK 1 . 5 addition .