Top Description Fields Constructors Methods
org.apache.commons.jexl2.internal

public Class ArrayIterator

extends Object
implements Iterator<Object>
Class Inheritance
All Implemented Interfaces
java.util.Iterator
Imports
java.util.Iterator, .NoSuchElementException, java.lang.reflect.Array

An Iterator wrapper for an Object[]. This will allow us to deal with all array like structures in a consistent manner.

WARNING : this class's operations are NOT synchronized. It is meant to be used in a single thread, newly created for each use in the #foreach() directive. If this is used or shared, synchronize in the next() method.

Since
1.0

Field Summary

Modifier and TypeField and Description
private final Object
array

The objects to iterate over.

private int
pos

The current position and size in the array.

private final int
size

The size of the array.

Constructor Summary

AccessConstructor and Description
public
ArrayIterator(Object
The array for which an iterator is desired.
arr
)

Creates a new iterator instance for the specified array.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

Whether there is another element.
hasNext
()

Implements java.util.Iterator.hasNext.

Check to see if there is another element in the array.
public Object

Returns:

The next object in the array.
next
()

Implements java.util.Iterator.next.

Move to next element in the array.
public void
remove()

Overrides default java.util.Iterator.remove.

No op--merely added to satify the Iterator interface.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayback to summary
private final Object array

The objects to iterate over.

posback to summary
private int pos

The current position and size in the array.

sizeback to summary
private final int size

The size of the array.

Constructor Detail

ArrayIteratorback to summary
public ArrayIterator(Object arr)

Creates a new iterator instance for the specified array.

Parameters
arr:Object

The array for which an iterator is desired.

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Check to see if there is another element in the array.

Returns:boolean

Whether there is another element.

nextback to summary
public Object next()

Implements java.util.Iterator.next.

Move to next element in the array.

Returns:Object

The next object in the array.

removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

No op--merely added to satify the Iterator interface.