|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.colorado.collections.CharQueue
public class CharQueue
A CharQueue is a queue of char values.
add, clone,
and union will result in an
OutOfMemoryError when free memory is exhausted.
Integer.MAX_VALUE). Any attempt to create a larger capacity
results in a failure due to an arithmetic overflow.
CharLinkedQueue,
ObjectQueue,
BooleanQueue,
ByteQueue,
DoubleQueue,
FloatQueue,
IntQueue,
LongQueue,
ShortQueue| Constructor Summary | |
|---|---|
CharQueue()
Initialize an empty queue with an initial capacity of 10. |
|
CharQueue(int initialCapacity)
Initialize an empty queue with a specified initial capacity. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Generate a copy of this queue. |
void |
ensureCapacity(int minimumCapacity)
Change the current capacity of this queue. |
int |
getCapacity()
Accessor method to get the current capacity of this queue. |
char |
getFront()
Get the front item, removing it from this queue. |
void |
insert(char item)
Insert a new item in this queue. |
boolean |
isEmpty()
Determine whether this queue is empty. |
int |
size()
Accessor method to determine the number of items in this queue. |
void |
trimToSize()
Reduce the current capacity of this queue to its actual size (i.e., the number of items it contains). |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CharQueue()
insert method works efficiently (without needing more
memory) until this capacity is reached.
- - none
java.lang.OutOfMemoryError - Indicates insufficient memory for:
new char[10].public CharQueue(int initialCapacity)
insert method works efficiently (without needing more
memory) until this capacity is reached.
initialCapacity - the initial capacity of this queue
initialCapacity is non-negative.
java.lang.IllegalArgumentException - Indicates that initialCapacity is negative.
java.lang.OutOfMemoryError - Indicates insufficient memory for:
new char[initialCapacity].| Method Detail |
|---|
public java.lang.Object clone()
clone in class java.lang.Object- - none
CharQueue before it can be used.
java.lang.OutOfMemoryError - Indicates insufficient memory for creating the clone.public void ensureCapacity(int minimumCapacity)
minimumCapacity - the new capacity for this queue
minimumCapacity.
If the capacity was already at or greater than minimumCapacity,
then the capacity is left unchanged.
java.lang.OutOfMemoryError - Indicates insufficient memory for: new char[minimumCapacity].public int getCapacity()
insert method works efficiently (without needing
more memory) until this capacity is reached.
- - none
public char getFront()
- - none
java.util.NoSuchElementException - Indicates that this queue is empty.public void insert(char item)
item - the item to be pushed onto this queue
java.lang.OutOfMemoryError - Indicates insufficient memory for increasing the queue's capacity.
Integer.MAX_VALUE will cause the queue to fail with an
arithmetic overflow.public boolean isEmpty()
- - none
true if this queue is empty;
false otherwise.public int size()
- - none
public void trimToSize()
- - none
java.lang.OutOfMemoryError - Indicates insufficient memory for altering the capacity.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||