Constructor and Description |
---|
LQueue()
Default constructor initializes an empty queue.
|
LQueue(int capacity)
This constructor initializes an empty queue and set its capacity.
|
Modifier and Type | Method and Description |
---|---|
int |
capacity() |
T |
element()
Peek at the first item at the front end.
|
boolean |
empty() |
boolean |
offer(T item)
Offer the item into this Queue at the rear end.
|
T |
peek()
Peek at the first item at the front end.
|
T |
peekRear() |
T |
poll()
Remove the item at the front end.
|
T |
remove()
Remove the item from the Queue at the front end.
|
int |
size() |
public LQueue()
public LQueue(int capacity)
capacity
- is the initial capacity of the internal arraypublic boolean offer(T item)
Queue
public T remove()
Queue
public T poll()
Queue
public T peek()
Queue
public T peekRear()
public T element()
Queue
public int size()
public int capacity()