public interface Cursor
Cursoris a kind of hybrid between Java standard
System.Collections.IEnumeratorinterface from .NET framework.
Cursor interface design typically permits slightly faster implementation,
Iterator, so it is preferred in performance-critical code.
On the other hand, isn't supported by Java's "for-each" syntax.
See the comparison of iteration ways in the library.
|Modifier and Type||Method and Description|
Moves the cursor forward to the next element (to the first element, if the cursor is in front of the first element).
Removes the element to which the cursor currently points (optional operation).
trueif it exists,
falseotherwise. The cursor is located after the last element in the iteration and doesn't point to any element after the unsuccessful movement.
trueif the cursor has moved forward to the next element,
falseif the iteration has no more elements
IllegalStateException if the cursor isn't pointing to any element: if it
is in front of the first element, after the last, or the current element has been already
UnsupportedOperationException- if the
removeoperation is not supported by this cursor
IllegalStateException- if this cursor is initially in front of the first element and
moveNext()hasn't been called yet, or the previous call of
remove()has been already performed after the previous cursor movement