E - the type of elements held in this collectionpublic abstract class AbstractPollable<E> extends Object implements Pollable<E>
Pollable operations. The implementations in this class
are appropriate when the base implementation does not allow null elements. Methods remove, and element are based on poll, and peek, respectively, but
throw exceptions instead of indicating failure via false or null returns.
A Pollable implementation that extends this class must minimally define methods Queue.peek() and
Queue.poll(). Typically, additional methods will be overridden as well.
| Constructor and Description |
|---|
AbstractPollable() |
| Modifier and Type | Method and Description |
|---|---|
E |
element()
Retrieves, but does not remove, the head of this queue.
|
E |
remove()
Retrieves and removes the head of this queue.
|
public E remove()
poll only in that it throws
an exception if this queue is empty.
This implementation returns the result of poll unless the queue is empty.
remove in interface Pollable<E>NoSuchElementException - if this queue is emptypublic E element()
peek only in that
it throws an exception if this queue is empty.
This implementation returns the result of peek unless the queue is empty.
element in interface Pollable<E>NoSuchElementException - if this queue is emptyCopyright © 2022 Internet2. All rights reserved.