|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectArray<D>
D - The type of the data stored in an array.public class Array<D>
An array is more convenient class of the built-in arrays. It can be used with generic data of type D, and it is size adjusting.
| Constructor Summary | |
|---|---|
Array()
Creates an empty array with default capacity. |
|
Array(int s)
Creates an empty array with capacity s. |
|
| Method Summary | |
|---|---|
D |
get(int i)
Gets the i-th element of this array (in constant time). |
boolean |
isempty()
Checks whether this array is empty (constant time) |
SimpleIterator<D> |
iterator()
Delivers an iterator over the objects stored in this array. |
void |
permute_randomly(java.util.Random r)
Permutes this array randomly using the given random number generator r. |
void |
print()
Prints this array to stdout. |
void |
resize(int s)
Ensures that after this call this array can access all elements with index i ≤ s in constant time and sets the size to s. |
void |
set(int i,
D d)
Sets the i-th element of this array to d. |
int |
size()
Returns the size of this array (constant time) |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Array(int s)
s - The initial capacity of the array, must be non-negative.public Array()
| Method Detail |
|---|
public int size()
public boolean isempty()
public void resize(int s)
s - Resize the array to have at least capacity s, if the current
capacity is not high enough.
public void set(int i,
D d)
i - The index of element that should be returned, must be non-negative.d - The datum that should be stored at the i-th position of this array.public D get(int i)
i - The index of element that should be returned, must be non-negative.public void permute_randomly(java.util.Random r)
r - The random number generator.public void print()
public SimpleIterator<D> iterator()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||