All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.org.python.core.JavaIterator Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

There is a newer version: 2.7.4
Show newest version
package org.python.core;

import java.util.Iterator;

public class JavaIterator extends PyIterator {

    final private Iterator proxy;

    public JavaIterator(Iterable proxy) {
        this(proxy.iterator());
    }

    public JavaIterator(Iterator proxy) {
        this.proxy = proxy;
    }

    public PyObject __iternext__() {
        return proxy.hasNext() ? Py.java2py(proxy.next()) : null;
    }
}