T - public static interface C.List.Cursor<T>
List. It performs like
ListIterator but differs in the following way:
| Modifier and Type | Method and Description |
|---|---|
C.List.Cursor<T> |
append(T t)
Add an element after the element this cursor points to.
|
C.List.Cursor<T> |
backward()
Move the cursor backward to make it point to the previous element to
the current element
|
C.List.Cursor<T> |
drop()
Remove the current element this cursor points to.
|
C.List.Cursor<T> |
forward()
Move the cursor forward to make it point to the next element to
the current element
|
T |
get()
Returns the element this cursor points to.
|
boolean |
hasNext()
Returns if the cursor can be moved forward to get the
next element
|
boolean |
hasPrevious()
Returns if the cursor can be moved backward to get the previous
element
|
int |
index()
Returns the index of the element to which the cursor pointed
|
boolean |
isDefined()
Returns true if the cursor is not obsolete and points to an element
in the list
|
C.List.Cursor<T> |
parkLeft()
Park the cursor at the position before the first element.
|
C.List.Cursor<T> |
parkRight()
Park the cursor at the position after the last element
|
C.List.Cursor<T> |
prepend(T t)
Add an element in front of the element this cursor points to.
|
C.List.Cursor<T> |
set(T t)
Replace the element this cursor points to with the new element specified.
|
boolean isDefined()
int index()
boolean hasNext()
true if there are element after the cursor in the
underline listboolean hasPrevious()
true if there are element before the cursor in the
underline listC.List.Cursor<T> forward() throws UnsupportedOperationException
UnsupportedOperationException - if cannot move forward anymoreC.List.Cursor<T> backward() throws UnsupportedOperationException
UnsupportedOperationException - if cannot move backward anymoreC.List.Cursor<T> parkLeft()
After calling this method, isDefined()
shall return false
C.List.Cursor<T> parkRight()
After calling this method, isDefined()
shall return false
T get() throws NoSuchElementException
NoSuchElementException been thrown out. The only case
the cursor doesn't point to any element is when it is initialized
in which case the cursor index is -1NoSuchElementException - if the cursor isn't point to any elementC.List.Cursor<T> set(T t) throws IndexOutOfBoundsException, NullPointerException
t - the new element to be set to this cursorIndexOutOfBoundsException - if the cursor isn't point to any elementNullPointerException - if when passing null value to this method and
the underline list does not allow null valueC.List.Cursor<T> drop() throws NoSuchElementException, UnsupportedOperationException
-1 position and the current element is not definedUnsupportedOperationException - if the operation is not supported
by the underline container does not support removing elementsNoSuchElementException - if the cursor is parked either left or
rightC.List.Cursor<T> prepend(T t) throws IndexOutOfBoundsException
t - the element to be insertedIndexOutOfBoundsException - if the current element is undefinedC.List.Cursor<T> append(T t)
t - the element to be addedCopyright © 2017. All Rights Reserved.