org.mozilla.javascript

## Class IteratorLikeIterable

- java.lang.Object
- - org.mozilla.javascript.IteratorLikeIterable

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Iterable<java.lang.Object>

      public class IteratorLikeIterable
      extends java.lang.Object
      implements java.lang.Iterable<java.lang.Object>, java.io.Closeable

  This is a class that makes it easier to iterate over "iterator-like" objects as defined in the ECMAScript spec. The caller is responsible for retrieving an object that implements the "iterator" pattern. This class will follow that pattern and throw appropriate JavaScript exceptions.

  The pattern that the target class should follow is: * It must have a function property called "next" * The function must return an object with a boolean value called "done". * If "done" is true, then the returned object should also contain a "value" property. * If it has a function property called "return" then it will be called when the caller is done iterating.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `IteratorLikeIterable.Itr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IteratorLikeIterable(Context cx, Scriptable scope, java.lang.Object target)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `IteratorLikeIterable.Itr` | `iterator()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### IteratorLikeIterable

          public IteratorLikeIterable(Context cx,
                                      Scriptable scope,
                                      java.lang.Object target)

  - ### Method Detail

    - #### close

          public void close()

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`

    - #### iterator

          public IteratorLikeIterable.Itr iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<java.lang.Object>`