Package org.jibx.runtime.impl
Class ArrayRangeIterator
java.lang.Object
org.jibx.runtime.impl.ArrayRangeIterator
- All Implemented Interfaces:
Iterator
Iterator class for values contained in an array range. This type of iterator
can be used for any contiguous range of items in an object array.
- Version:
- 1.1
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ArrayRangeIterator
Empty iterator used whenever possible.protected Object[]
Array supplying values for iteration.protected int
Ending offset for values.protected int
Offset of next iteration value. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
ArrayRangeIterator
(Object[] array, int start, int limit) Internal constructor. -
Method Summary
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
-
EMPTY_ITERATOR
Empty iterator used whenever possible. -
m_array
Array supplying values for iteration. -
m_offset
protected int m_offsetOffset of next iteration value. -
m_limit
protected int m_limitEnding offset for values.
-
-
Constructor Details
-
ArrayRangeIterator
Internal constructor.- Parameters:
array
- array containing values to be iteratedstart
- starting offset in arraylimit
- offset past end of values
-
-
Method Details
-
hasNext
public boolean hasNext()Check for iteration element available. -
next
Get next iteration element.- Specified by:
next
in interfaceIterator
- Returns:
- next iteration element
- Throws:
NoSuchElementException
- if past end of iteration
-
remove
public void remove()Remove element from iteration. This optional operation is not supported and always throws an exception.- Specified by:
remove
in interfaceIterator
- Throws:
UnsupportedOperationException
- for unsupported operation
-
buildIterator
Build iterator.- Parameters:
array
- array containing values to be iterated (may benull
)start
- starting offset in arraylimit
- offset past end of values- Returns:
- constructed iterator
-