Class ArrayAdapter.ArrayIterator
java.lang.Object
org.datanucleus.store.types.containers.ArrayAdapter.ArrayIterator
- All Implemented Interfaces:
Iterator
- Enclosing class:
ArrayAdapter<C>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionArrayIterator(Object array) Constructs an ArrayIterator that will iterate over the values in the specified array. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()Returns true if there are more elements to return from the array.next()Returns the next element in the array.voidremove()ThrowsUnsupportedOperationException.voidSets the array that the ArrayIterator should iterate over.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
array
The array to iterate over -
endIndex
protected int endIndexThe end index to loop to -
index
protected int indexThe current iterator index
-
-
Constructor Details
-
ArrayIterator
Constructs an ArrayIterator that will iterate over the values in the specified array.- Parameters:
array- the array to iterate over.- Throws:
IllegalArgumentException- ifarrayis not an array.NullPointerException- ifarrayisnull
-
-
Method Details
-
hasNext
-
next
Returns the next element in the array.- Specified by:
nextin interfaceIterator- Returns:
- the next element in the array
- Throws:
NoSuchElementException- if all the elements in the array have already been returned
-
remove
public void remove()ThrowsUnsupportedOperationException.- Specified by:
removein interfaceIterator- Throws:
UnsupportedOperationException- always
-
setArray
Sets the array that the ArrayIterator should iterate over.If an array has previously been set (using the single-arg constructor or this method) then that array is discarded in favour of this one. Iteration is restarted at the start of the new array. Although this can be used to reset iteration, the
method is a more effective choice.invalid reference
#reset()- Parameters:
array- the array that the iterator should iterate over.- Throws:
IllegalArgumentException- ifarrayis not an array.NullPointerException- ifarrayisnull
-