E
- The element on which this cursor will iteratepublic class ListCursor<E> extends AbstractCursor<E>
List
. Optionally, the
Cursor may be limited to a specific range within the list.Constructor and Description |
---|
ListCursor()
Creates a new ListCursor without any elements.
|
ListCursor(Comparator<E> comparator)
Creates a new ListCursor without any elements.
|
ListCursor(Comparator<E> comparator,
int start,
List<E> list)
Creates a new ListCursor with a lower (inclusive) bound: the upper
(exclusive) bound is the size of the list.
|
ListCursor(Comparator<E> comparator,
int start,
List<E> list,
int end)
Creates a new ListCursor with lower (inclusive) and upper (exclusive)
bounds.
|
ListCursor(Comparator<E> comparator,
List<E> list)
Creates a new ListCursor without specific bounds: the bounds are
acquired from the size of the list.
|
ListCursor(Comparator<E> comparator,
List<E> list,
int end)
Creates a new ListCursor with a specific upper (exclusive) bound: the
lower (inclusive) bound defaults to 0.
|
ListCursor(int start,
List<E> list)
Creates a new ListCursor with a lower (inclusive) bound: the upper
(exclusive) bound is the size of the list.
|
ListCursor(int start,
List<E> list,
int end)
Creates a new ListCursor with lower (inclusive) and upper (exclusive)
bounds.
|
ListCursor(List<E> list)
Creates a new ListCursor without specific bounds: the bounds are
acquired from the size of the list.
|
ListCursor(List<E> list,
int end)
Creates a new ListCursor with a specific upper (exclusive) bound: the
lower (inclusive) bound defaults to 0.
|
Modifier and Type | Method and Description |
---|---|
void |
after(E element)
Prepares this Cursor, so a subsequent call to Cursor#previous() with a
true return value, will have positioned the Cursor on a dataSet element
equal to or less than the element argument but not greater.
|
void |
afterLast()
Positions this Cursor after the last element.
|
boolean |
available()
Determines whether or not a call to get() will succeed.
|
void |
before(E element)
Prepares this Cursor, so a subsequent call to Cursor#next() with a
true return value, will have positioned the Cursor on a dataSet
element equal to or less than the element argument but not greater.
|
void |
beforeFirst()
Positions this Cursor before the first element.
|
void |
close() |
void |
close(Exception cause)
Closes this Cursor and frees any resources it my have allocated.
|
boolean |
first()
Positions this Cursor at the first element.
|
E |
get()
Gets the object at the current position.
|
boolean |
isAfterLast()
Is this Cursor positioned after the last element.
|
boolean |
isBeforeFirst()
Is this Cursor positioned before the first element.
|
boolean |
isFirst()
Is this Cursor positioned at the first element.
|
boolean |
isLast()
Is this Cursor positioned at the last element.
|
boolean |
last()
Positions this Cursor at the last element.
|
boolean |
next()
Advances this Cursor to the next position.
|
boolean |
previous()
Advances this Cursor to the previous position.
|
checkNotClosed, isClosed, iterator, setClosureMonitor, toString
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public ListCursor(Comparator<E> comparator, int start, List<E> list, int end)
comparator
- an optional comparator to use for orderingstart
- the lower bound indexlist
- the list this ListCursor operates onend
- the upper bound indexpublic ListCursor(int start, List<E> list, int end)
start
- the lower bound indexlist
- the list this ListCursor operates onend
- the upper bound indexpublic ListCursor(List<E> list, int end)
list
- the backing for this ListCursorend
- the upper bound index representing the position after the
last elementpublic ListCursor(Comparator<E> comparator, List<E> list, int end)
comparator
- The comparator to use for the <E> elementslist
- the backing for this ListCursorend
- the upper bound index representing the position after the
last elementpublic ListCursor(int start, List<E> list)
start
- the lower (inclusive) bound index: the position of the
first entrylist
- the backing for this ListCursorpublic ListCursor(Comparator<E> comparator, int start, List<E> list)
comparator
- The comparator to use for the <E> elementsstart
- the lower (inclusive) bound index: the position of the
first entrylist
- the backing for this ListCursorpublic ListCursor(List<E> list)
list
- the backing for this ListCursorpublic ListCursor(Comparator<E> comparator, List<E> list)
comparator
- The comparator to use for the <E> elementslist
- the backing for this ListCursorpublic ListCursor()
public ListCursor(Comparator<E> comparator)
comparator
- The comparator to use for the <E> elementspublic boolean available()
public void before(E element) throws LdapException, CursorException
element
- the element to be positioned beforeLdapException
- if we have get any LDAP exception while operating
the cursorCursorException
- if there are problems advancing to this Cursor before
the given element, or if this Cursor is closedpublic void after(E element) throws LdapException, CursorException
element
- the element to be positioned afterLdapException
- if we have get any LDAP exception while operating
the cursorCursorException
- if there are problems advancing to this Cursor after
the given element, or if this Cursor is closedpublic void beforeFirst() throws LdapException, CursorException
LdapException
- if we have get any LDAP exception while operating
the cursorCursorException
- if there are problems advancing to this Cursor before
the first position, or if this Cursor is closedpublic void afterLast() throws LdapException, CursorException
LdapException
- if we have get any LDAP exception while operating
the cursorCursorException
- if there are problems advancing to this Cursor after
the last position, or if this Cursor is closedpublic boolean first() throws LdapException, CursorException
LdapException
- if we have get any LDAP exception while operating
the cursorCursorException
- if there are problems advancing to this Cursor to
the first position, or if this Cursor is closedpublic boolean last() throws LdapException, CursorException
LdapException
- if we have get any LDAP exception while operating
the cursorCursorException
- if there are problems advancing to this Cursor to
the last position, or if this Cursor is closedpublic boolean isFirst()
public boolean isLast()
public boolean isAfterLast()
isAfterLast
in interface Cursor<E>
isAfterLast
in class AbstractCursor<E>
public boolean isBeforeFirst()
isBeforeFirst
in interface Cursor<E>
isBeforeFirst
in class AbstractCursor<E>
public boolean previous() throws LdapException, CursorException
LdapException
- if we have get any LDAP exception while operating
the cursorCursorException
- if there are problems advancing to this Cursor to
the previous position, or if this Cursor is closedpublic boolean next() throws LdapException, CursorException
LdapException
- if we have get any LDAP exception while operating
the cursorCursorException
- if there are problems advancing to this Cursor to
the next position, or if this Cursor is closedpublic E get() throws CursorException
CursorException
- if the object at this Cursor's current position
cannot be retrieved, or if this Cursor is closedpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class AbstractCursor<E>
IOException
public void close(Exception cause) throws IOException
close
in interface Cursor<E>
close
in class AbstractCursor<E>
cause
- exception thrown when this Cursor is accessed after closeIOException
- If we can't close the CursorCopyright © 2003–2021 The Apache Software Foundation. All rights reserved.