org.mozilla.javascript.IteratorLikeIterable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rhino Show documentation
Show all versions of rhino Show documentation
Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically
embedded into Java applications to provide scripting to end users.
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.javascript;
import java.io.Closeable;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* 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.
*/
public class IteratorLikeIterable implements Iterable
© 2015 - 2024 Weber Informatics LLC | Privacy Policy