|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectResizableArray
public class ResizableArray
Field Summary | |
---|---|
static int |
DEFAULT_SIZE
|
Constructor Summary | |
---|---|
ResizableArray()
Creates a resizable array with DEFAULT_SIZE elements. |
|
ResizableArray(int size)
Creates a resizable array with the given number of elements. |
Method Summary | |
---|---|
void |
add(java.lang.Object o)
Adds the given object to the end of this ResizableArray, resizing the underlying array if necessary. |
int |
capacity()
Returns the capacity of this array. |
java.lang.Object |
get(int pos)
Returns the element at the given index. |
void |
insertBefore(java.lang.Object o,
int pos)
Inserts an element before the element at the given position and increases the size of this array. |
boolean |
isEmpty()
|
void |
removeElementAt(int pos)
Removes the element at the given index, shifting all subsequent elements forward and decreasing the size of this array by one. |
void |
set(int pos,
java.lang.Object o)
Sets the element at the give index. |
int |
size()
Returns the size of this array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_SIZE
Constructor Detail |
---|
public ResizableArray()
public ResizableArray(int size)
size
- Method Detail |
---|
public int capacity()
public int size()
public boolean isEmpty()
public void removeElementAt(int pos)
pos
- the index of the element to remove.public void insertBefore(java.lang.Object o, int pos)
o
- the object to insertpos
- the index where pos is to be inserted.public java.lang.Object get(int pos)
pos
- the array position
public void set(int pos, java.lang.Object o)
o
- the object to give to element pos of this arraypos
- the element to updatepublic void add(java.lang.Object o)
o
- the Object to add
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |