|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This interface adds queue-like access to an object.
| Field Summary | |
static Function |
FACTORY_METHOD
A factory method to create a default Queue. |
| Method Summary | |
void |
clear()
Removes all elements form the Queue. |
void |
close()
Releases resources needed to access data. |
boolean |
hasNext()
Returns true if the iteration has more elements. |
void |
insert(java.lang.Object object)
Appends an object to the end of the queue. |
void |
insertAll(java.util.Iterator objects)
Appends all objects of the specified iterator to the end of the queue. |
java.lang.Object |
next()
Returns the next element in the iteration. |
java.lang.Object |
peek()
Shows the next element in the iteration without removing it. |
java.lang.Object |
replace(java.lang.Object object)
Inserts a given object and returns this.next(). |
java.util.Iterator |
replaceAll(java.util.Iterator objects)
Inserts a given Iterator of objects and returns an Iterator wrapping calls to this.next(). |
int |
size()
Returns the size of the Queue. |
boolean |
supportsPeek()
Returns true if the peek operation is supported by this PeekIterator. |
| Methods inherited from interface xxl.cursors.PeekIterator |
remove |
| Field Detail |
public static final Function FACTORY_METHOD
| Method Detail |
public void insert(java.lang.Object object)
object - object to be appended to the queuepublic void insertAll(java.util.Iterator objects)
while(objects.hasNext()){
insert(objects.next());
}
We did not include this code, because Java does not support
multiple inheritance. Note, that this method is implemented in
AbstractQueue.
IMPORTANT:
This method is not named insertAll(Iterator) for the follwing
reason: consider that you have a Queue whose entries are
Iterators. A call to insert would result in a call to
insert(Iterator) and all the elements of the Iterator would
be inserted into the Queue, which would not be what you
wanted and is a very nasty bug.objects - iterator of objectspublic boolean hasNext()
public java.lang.Object peek()
throws java.util.NoSuchElementException
public java.lang.Object next()
throws java.util.NoSuchElementException
public java.lang.Object replace(java.lang.Object object)
throws java.util.NoSuchElementException
this.next().
public java.util.Iterator replaceAll(java.util.Iterator objects)
throws java.util.NoSuchElementException
this.next().
(lazy evaluation)public int size()
public boolean supportsPeek()
public void clear()
public void close()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||