T
- The type of elements in the queuepublic class FastRemovalDequeue<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
FastRemovalDequeue.Entry
Implementation of a doubly linked list entry.
|
Modifier and Type | Field and Description |
---|---|
protected FastRemovalDequeue.Entry |
first
First element of the queue.
|
protected FastRemovalDequeue.Entry |
last
Last element of the queue.
|
Constructor and Description |
---|
FastRemovalDequeue(int maxSize)
Initialize empty queue.
|
Modifier and Type | Method and Description |
---|---|
int |
getSize()
Retrieve the size of the list.
|
void |
moveFirst(FastRemovalDequeue.Entry element)
Moves the element in front.
|
void |
moveLast(FastRemovalDequeue.Entry element)
Moves the element to the back.
|
T |
pop()
Removes the last element of the list and returns its content.
|
FastRemovalDequeue.Entry |
push(T object)
Adds an object to the start of the list and returns the entry created for
said object.
|
void |
remove(FastRemovalDequeue.Entry element)
Removes any element of the list and returns its content.
|
FastRemovalDequeue.Entry |
unpop(T object)
Adds an object to the end of the list and returns the entry created for
said object.
|
T |
unpush()
Removes the first element of the list and returns its content.
|
protected FastRemovalDequeue.Entry first
protected FastRemovalDequeue.Entry last
public FastRemovalDequeue(int maxSize)
maxSize
- The maximum size to which the queue will be allowed to
growpublic int getSize()
public FastRemovalDequeue.Entry push(T object)
object
- the object to prepend to the start of the list.public FastRemovalDequeue.Entry unpop(T object)
object
- the object to append to the end of the list.public T unpush()
public T pop()
public void remove(FastRemovalDequeue.Entry element)
element
- The element to removepublic void moveFirst(FastRemovalDequeue.Entry element)
element
- the entry to move in front.public void moveLast(FastRemovalDequeue.Entry element)
element
- the entry to move to the back.Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.