public class Deque extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
m_Back
the index into m_Objs that indicates the back of the queue
|
protected int |
m_Len
the number of elements in the Deque
|
protected Object[] |
m_Objs |
Constructor and Description |
---|
Deque()
Construct an empty Deque.
|
Deque(int size)
Construct an empty Deque with the provided initial buffer size.
|
Modifier and Type | Method and Description |
---|---|
void |
copyInto(Object[] dest)
Copy every element in this Deque into the given array.
|
void |
copyInto(Object[] dest,
int offset)
Copy every element in this Deque into the given array, starting
at the given offset into the array.
|
Object |
popBack()
Remove an object from the back of this Deque
|
Object |
popFront()
Remove an object from the front of this Deque
|
void |
pushBack(Object o)
Insert an object on the back of this Deque
|
void |
pushFront(Object o)
Insert an object on the front of this Deque
|
int |
size()
Return the number of elements currently in this Deque.
|
protected Object[] m_Objs
protected int m_Back
protected int m_Len
public Deque()
public Deque(int size)
size
- - the initial capacity of this Dequepublic void pushFront(Object o)
o
- - the object to insertpublic void pushBack(Object o)
o
- - the object to insertpublic Object popFront()
public Object popBack()
public int size()
public void copyInto(Object[] dest)
dest
- - the destination arraypublic void copyInto(Object[] dest, int offset)
dest
- - the destination arrayoffset
- - the index into dest at which the copying begins.Copyright © 2023. All rights reserved.