Top Description Methods
org.graalvm.polyglot.proxy

public Interface ProxyIterator

Additional top-level class in compilation unit: DefaultProxyIterator.

extends Proxy
Known Direct Implementers
org.graalvm.polyglot.proxy.DefaultProxyIterator, org.graalvm.polyglot.proxy.DefaultProxyArrayIterator
Imports
org.graalvm.polyglot.Value, java.util.ConcurrentModificationException, .Iterator, .NoSuchElementException, .Objects

Interface to be implemented to mimic guest language iterators.
Since
21.1
See Also
Proxy, ProxyIterable

Method Summary

Modifier and TypeMethod and Description
public static ProxyIterator
from(Iterator<?> iterator)

Creates a proxy iterator backed by a Java Iterator.

public Object
getNext()

Returns the next element in the iteration.

public boolean
hasNext()

Returns true if the iterator has more elements, else false.

Method Detail

fromback to summary
public static ProxyIterator from(Iterator<?> iterator)

Creates a proxy iterator backed by a Java Iterator. If the set values are host values then they will be unboxed. If the Java Iterator throws the ConcurrentModificationException the exception is translated into the host exception.

Since
21.1
getNextback to summary
public Object getNext() throws NoSuchElementException, UnsupportedOperationException

Returns the next element in the iteration. When the underlying data structure is modified the getNext() may throw the NoSuchElementException even when the hasNext() returned true.

Exceptions
NoSuchElementException:
if the iteration has no more elements, the hasNext() returns false.
UnsupportedOperationException:
when the underlying iterator element exists but is not readable.
Since
21.1
See Also
hasNext()
hasNextback to summary
public boolean hasNext()

Returns true if the iterator has more elements, else false. Multiple calls to the hasNext() might lead to different results if the underlying data structure is modified.

Since
21.1
See Also
getNext()