class ByteArrayList
extends java.lang.Object
ByteArrays and maintains several useful invariants.| Modifier and Type | Class and Description |
|---|---|
class |
ByteArrayList.Node
A node within the linked list.
|
| Modifier and Type | Field and Description |
|---|---|
private int |
firstByte
The first byte in the array list
|
private ByteArrayList.Node |
header
A
ByteArrayList.Node which indicates the start and end of the list and does not
hold a value. |
private int |
lastByte
The last byte in the array list
|
| Modifier | Constructor and Description |
|---|---|
protected |
ByteArrayList()
Creates a new instance of ByteArrayList.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFirst(ByteArray ba)
Adds the specified
ByteArray to
the beginning of the list |
void |
addLast(ByteArray ba)
Add the specified
ByteArray to
the end of the list |
protected void |
addNode(ByteArrayList.Node nodeToInsert,
ByteArrayList.Node insertBeforeNode)
Inserts a new node into the list.
|
int |
firstByte()
Returns the first byte in the array list
|
ByteArrayList.Node |
getFirst()
Returns the first node in the byte array
|
ByteArrayList.Node |
getLast()
Returns the last
ByteArrayList.Node in the list |
boolean |
isEmpty()
Check to see if this is empty
|
int |
lastByte()
Returns the last byte in the array list
|
ByteArrayList.Node |
removeFirst()
Removes the first node from this list
|
ByteArrayList.Node |
removeLast()
Removes the last node in this list
|
protected ByteArrayList.Node |
removeNode(ByteArrayList.Node node)
Removes the specified node from the list.
|
private final ByteArrayList.Node header
ByteArrayList.Node which indicates the start and end of the list and does not
hold a value. The value of next is the first item in the
list. The value of of previous is the last item in the list.private int firstByte
private int lastByte
public int lastByte()
public int firstByte()
public boolean isEmpty()
public ByteArrayList.Node getFirst()
public ByteArrayList.Node getLast()
ByteArrayList.Node in the listpublic void addFirst(ByteArray ba)
ByteArray to
the beginning of the listba - The ByteArray to be added to the listpublic void addLast(ByteArray ba)
ByteArray to
the end of the listba - The ByteArray to be added to the listpublic ByteArrayList.Node removeFirst()
public ByteArrayList.Node removeLast()
protected void addNode(ByteArrayList.Node nodeToInsert, ByteArrayList.Node insertBeforeNode)
nodeToInsert - new node to insertinsertBeforeNode - node to insert beforeprotected ByteArrayList.Node removeNode(ByteArrayList.Node node)
node - the node to remove