TYPE
- Type of elements in the queuepublic class Queue<TYPE>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Queue.Element<ELEMENT>
Element of the queue
|
Modifier and Type | Field and Description |
---|---|
private Queue.Element<TYPE> |
head
Queue head (first element)
|
private Queue.Element<TYPE> |
queue
Queue queue (last element)
|
Constructor and Description |
---|
Queue()
Create a new instance of empty Queue
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the queue
|
void |
inQueue(TYPE element)
Add element at the end of the queue
|
boolean |
isEmpty()
Indicates if queue is empty
|
TYPE |
outQueue()
Get the head of the queue and remove it
|
TYPE |
peek()
Look the head of the queue but not remove
|
void |
remove(TYPE element)
Remove a specific element of the queue
|
java.lang.String |
toString()
String representation
Parent documentation: |
private Queue.Element<TYPE> head
private Queue.Element<TYPE> queue
public void clear()
public void inQueue(TYPE element)
element
- Element to addpublic boolean isEmpty()
true
if queue is emptypublic TYPE outQueue()
java.lang.IllegalStateException
- If queue is emptypublic TYPE peek()
java.lang.IllegalStateException
- If queue is emptypublic void remove(TYPE element)
element
- Element to removepublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()