|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An OrderedCollection is a collection of objects where the objects have a location in the collection. The objects can be accessed by their location ( or index) in the collection. The first object is in location (index) 0 (zero).
Method Summary | |
void |
addElement(double aDouble)
Adds the specified double as the last element of the OrderedCollection. |
void |
addElement(int anInt)
Adds the specified int as the last element of the OrderedCollection. |
void |
addElement(java.lang.Object obj)
Adds the specified object as the last element of the OrderedCollection. |
void |
addElements(java.lang.Object[] elementsToAdd)
Adds the elements of an array to the end of the collection. |
void |
addElements(java.util.Vector elementsToAdd)
Adds the elements of a Vector to the end of the collection. |
int |
capacity()
Returns the current capacity of the OrderedCollection. |
boolean |
contains(java.lang.Object elem)
Returns true if the specified object is a value of the collection. |
double |
doubleAt(int index)
Returns the double at the specified index. |
java.lang.Object |
elementAt(int index)
Returns the element at the specified index. |
java.util.Enumeration |
elements()
Returns an enumeration of the elements. |
java.util.Enumeration |
elementsReversed()
Returns an enumeration of the elements inrevese order. |
void |
ensureCapacity(int minCapacity)
Ensures that the OrderedCollection has at least the specified capacity. |
java.lang.Object |
firstElement()
Returns the first element of the sequence. |
int |
indexOf(java.lang.Object elem)
Searches for the specified object, starting from the first position and returns an index to it. |
int |
indexOf(java.lang.Object elem,
int index)
Searches for the specified object, starting at the specified position and returns an index to it. |
void |
insertElementAt(java.lang.Object obj,
int index)
Inserts the specified object as an element at the specified index. |
int |
intAt(int index)
Returns the int at the specified index. |
boolean |
isEmpty()
Returns true if the collection contains no values. |
java.lang.Object |
lastElement()
Returns the last element of the sequence. |
int |
lastIndexOf(java.lang.Object elem)
Searches backwards for the specified object, starting from the last position and returns an index to it. |
int |
lastIndexOf(java.lang.Object elem,
int index)
Searches backwards for the specified object, starting from the specified position and returns an index to it. |
void |
removeAllElements()
Removes all elements of the OrderedCollection. |
boolean |
removeElement(java.lang.Object obj)
Removes the element from the OrderedCollection. |
void |
removeElementAt(int index)
Deletes the element at the specified index. |
OrderedCollection |
reversed()
Returns a OrderedCollection with elements in the reverse order from present OrderedCollection |
void |
setElementAt(java.lang.Object obj,
int index)
Sets the element at the specified index to be the specified object. |
void |
setSize(int newSize)
Sets the size of the OrderedCollection. |
OrderedCollection |
shuffled()
Returns a OrderedCollection with elements from present OrderedCollection, but in random order. |
int |
size()
Returns the number of elements in the OrderedCollection. |
java.lang.Object[] |
toArray()
Converts the OrderedCollection to an array. |
java.util.Vector |
toVector()
Converts the OrderedCollection to a vector. |
void |
trimToSize()
Trims the OrderedCollection's capacity down to size. |
Method Detail |
public java.util.Vector toVector()
public java.lang.Object[] toArray()
public void trimToSize()
public void ensureCapacity(int minCapacity)
minCapacity
- the desired minimum capacitypublic void setSize(int newSize)
newSize
- the new size of the OrderedCollectionpublic int capacity()
public int size()
public boolean isEmpty()
public java.util.Enumeration elements()
public java.util.Enumeration elementsReversed()
public boolean contains(java.lang.Object elem)
elem
- the desired elementpublic int indexOf(java.lang.Object elem)
elem
- the desired elementpublic int indexOf(java.lang.Object elem, int index)
elem
- the desired elementindex
- the index where to start searchingpublic int lastIndexOf(java.lang.Object elem)
elem
- the desired elementpublic int lastIndexOf(java.lang.Object elem, int index)
elem
- the desired elementindex
- the index where to start searchingpublic java.lang.Object elementAt(int index)
index
- the index of the desired elementpublic int intAt(int index)
index
- the index of the desired elementpublic double doubleAt(int index)
index
- the index of the desired elementpublic java.lang.Object firstElement()
public java.lang.Object lastElement()
public void setElementAt(java.lang.Object obj, int index)
obj
- what the element is to be set toindex
- the specified indexpublic void removeElementAt(int index)
index
- the element to removepublic void insertElementAt(java.lang.Object obj, int index)
obj
- the element to insertindex
- where to insert the new elementpublic void addElement(java.lang.Object obj)
obj
- the element to be addedpublic void addElement(int anInt)
anInt
- the element to be addedpublic void addElement(double aDouble)
aFloat
- the element to be addedpublic void addElements(java.util.Vector elementsToAdd)
elementsToAdd
- the elements to be addedpublic void addElements(java.lang.Object[] elementsToAdd)
elementsToAdd
- the elements to be addedpublic boolean removeElement(java.lang.Object obj)
obj
- the element to be removedpublic void removeAllElements()
public OrderedCollection reversed()
public OrderedCollection shuffled()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |