public class Queue extends Object implements Enumeration
dequeue()
operation.Constructor and Description |
---|
Queue()
Makes a Queue that can hold any object.
|
Queue(Class elementType)
Makes a Queue that can hold objects of the specified
elementType.
|
Modifier and Type | Method and Description |
---|---|
Object |
dequeue()
Get the least-recently-added element off of the queue.
|
void |
enqueue(Object newElement)
Add a new element to the queue.
|
boolean |
hasMoreElements()
Check to see if the queue has more elements.
|
Object |
nextElement()
Get the least-recently-added element off of the queue.
|
Object |
optDequeue()
Get the least-recently-added element off of the queue, or null
if the queue is currently empty.
|
public Queue()
public Queue(Class elementType)
elementType
- may not be a primitive (ie, scalar) type.public Object dequeue()
public void enqueue(Object newElement)
newElement
- the object to be added to the end of the queue.NullPointerException
- thrown if newElement is nullArrayStoreException
- thrown if newElement does not conform
to the elementType specified in the Queue constructor.public boolean hasMoreElements()
hasMoreElements
in interface Enumeration
public Object nextElement() throws NoSuchElementException
nextElement
in interface Enumeration
NoSuchElementException
public Object optDequeue()
Copyright © 2017. All rights reserved.