Class ArrayAdapter.ArrayIterator
java.lang.Object
org.datanucleus.store.types.containers.ArrayAdapter.ArrayIterator
- All Implemented Interfaces:
Iterator
- Enclosing class:
ArrayAdapter<C>
Based on Apache Collections 3.2 implementation
-
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 TypeMethodDescriptionboolean
hasNext()
Returns true if there are more elements to return from the array.next()
Returns the next element in the array.void
remove()
ThrowsUnsupportedOperationException
.void
Sets the array that the ArrayIterator should iterate over.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.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
- ifarray
is not an array.NullPointerException
- ifarray
isnull
-
-
Method Details
-
hasNext
public boolean hasNext()Returns true if there are more elements to return from the array. -
next
Returns the next element in the array.- Specified by:
next
in 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:
remove
in 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
invalid reference
#reset()
- Parameters:
array
- the array that the iterator should iterate over.- Throws:
IllegalArgumentException
- ifarray
is not an array.NullPointerException
- ifarray
isnull
-