|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
List is a collection which maintains an ordering for its elements. Every element in the list has an index.
| Method Summary | |
void |
add(int location,
java.lang.Object object)
Inserts the specified object into this Vector at the specified location. |
boolean |
add(java.lang.Object object)
Adds the specified object at the end of this List. |
boolean |
addAll(Collection collection)
Adds the objects in the specified Collection to the end of this List. |
boolean |
addAll(int location,
Collection collection)
Inserts the objects in the specified Collection at the specified location in this List. |
void |
clear()
Removes all elements from this List, leaving it empty. |
boolean |
contains(java.lang.Object object)
Searches this List for the specified object. |
boolean |
containsAll(Collection collection)
Searches this List for all objects in the specified Collection. |
boolean |
equals(java.lang.Object object)
Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison. |
java.lang.Object |
get(int location)
Answers the element at the specified location in this List. |
int |
hashCode()
Answers an integer hash code for the receiver. |
int |
indexOf(java.lang.Object object)
Searches this List for the specified object and returns the index of the first occurrence. |
boolean |
isEmpty()
Answers if this List has no elements, a size of zero. |
Iterator |
iterator()
Answers an Iterator on the elements of this List. |
int |
lastIndexOf(java.lang.Object object)
Searches this List for the specified object and returns the index of the last occurrence. |
ListIterator |
listIterator()
Answers a ListIterator on the elements of this List. |
ListIterator |
listIterator(int location)
Answers a ListIterator on the elements of this List. |
java.lang.Object |
remove(int location)
Removes the object at the specified location from this List. |
boolean |
remove(java.lang.Object object)
Removes the first occurrence of the specified object from this List. |
boolean |
removeAll(Collection collection)
Removes all occurrences in this List of each object in the specified Collection. |
boolean |
retainAll(Collection collection)
Removes all objects from this List that are not contained in the specified Collection. |
java.lang.Object |
set(int location,
java.lang.Object object)
Replaces the element at the specified location in this List with the specified object. |
int |
size()
Answers the number of elements in this List. |
List |
subList(int start,
int end)
Answers a List of the specified portion of this List from the start index to one less than the end index. |
java.lang.Object[] |
toArray()
Answers an array containing all elements contained in this List. |
java.lang.Object[] |
toArray(java.lang.Object[] array)
Answers an array containing all elements contained in this List. |
| Method Detail |
public void add(int location,
java.lang.Object object)
location - the index at which to insertobject - the object to add
UnsupportedOperationException - when adding to this List is not supported
ClassCastException - when the class of the object is inappropriate for this
List
IllegalArgumentException - when the object cannot be added to this List
IndexOutOfBoundsException - when location < 0 || >= size()public boolean add(java.lang.Object object)
add in interface Collectionobject - the object to add
UnsupportedOperationException - when adding to this List is not supported
ClassCastException - when the class of the object is inappropriate for this
List
IllegalArgumentException - when the object cannot be added to this List
public boolean addAll(int location,
Collection collection)
location - the index at which to insertcollection - the Collection of objects
UnsupportedOperationException - when adding to this List is not supported
ClassCastException - when the class of an object is inappropriate for this List
IllegalArgumentException - when an object cannot be added to this List
IndexOutOfBoundsException - when location < 0 || >= size()public boolean addAll(Collection collection)
addAll in interface Collectioncollection - the Collection of objects
UnsupportedOperationException - when adding to this List is not supported
ClassCastException - when the class of an object is inappropriate for this List
IllegalArgumentException - when an object cannot be added to this Listpublic void clear()
clear in interface CollectionUnsupportedOperationException - when removing from this List is not supportedisEmpty(),
size()public boolean contains(java.lang.Object object)
contains in interface Collectionobject - the object to search for
public boolean containsAll(Collection collection)
containsAll in interface Collectioncollection - the Collection of objects
public boolean equals(java.lang.Object object)
equals in interface Collectionobject - Object the object to compare with this object.
true if the object is the same as this
object false if it is different from this object.hashCode()public java.lang.Object get(int location)
location - the index of the element to return
IndexOutOfBoundsException - when location < 0 || >= size()public int hashCode()
hashCode in interface Collectionequals(java.lang.Object)public int indexOf(java.lang.Object object)
object - the object to search for
public boolean isEmpty()
isEmpty in interface Collectionsize()public Iterator iterator()
iterator in interface CollectionIteratorpublic int lastIndexOf(java.lang.Object object)
object - the object to search for
public ListIterator listIterator()
ListIteratorpublic ListIterator listIterator(int location)
location - the index at which to start the iteration
IndexOutOfBoundsException - when location < 0 || >= size()ListIteratorpublic java.lang.Object remove(int location)
location - the index of the object to remove
UnsupportedOperationException - when removing from this List is not supported
IndexOutOfBoundsException - when location < 0 || >= size()public boolean remove(java.lang.Object object)
remove in interface Collectionobject - the object to remove
UnsupportedOperationException - when removing from this List is not supportedpublic boolean removeAll(Collection collection)
removeAll in interface Collectioncollection - the Collection of objects to remove
UnsupportedOperationException - when removing from this List is not supportedpublic boolean retainAll(Collection collection)
retainAll in interface Collectioncollection - the Collection of objects to retain
UnsupportedOperationException - when removing from this List is not supported
public java.lang.Object set(int location,
java.lang.Object object)
location - the index at which to put the specified objectobject - the object to add
UnsupportedOperationException - when replacing elements in this List is not supported
ClassCastException - when the class of an object is inappropriate for this List
IllegalArgumentException - when an object cannot be added to this List
IndexOutOfBoundsException - when location < 0 || >= size()public int size()
size in interface Collection
public List subList(int start,
int end)
start - the index at which to start the sublistend - the index one past the end of the sublist
IndexOutOfBoundsException - when start < 0, start > end or
end > size()public java.lang.Object[] toArray()
toArray in interface Collectionpublic java.lang.Object[] toArray(java.lang.Object[] array)
toArray in interface Collectionarray - the array
ArrayStoreException - when the type of an element in this List cannot be stored
in the type of the specified array
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||