|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface List
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,
Object object)
Inserts the specified object into this Vector at the specified location. |
boolean |
add(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(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(Object object)
Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison. |
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(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(Object object)
Searches this List for the specified object and returns the index of the last occurrence. |
Object |
remove(int location)
Removes the object at the specified location from this List. |
boolean |
remove(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. |
Object |
set(int location,
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. |
Object[] |
toArray()
Answers an array containing all elements contained in this List. |
Object[] |
toArray(Object[] array)
Answers an array containing all elements contained in this List. |
| Method Detail |
|---|
void add(int location,
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()boolean add(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
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()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 Listvoid clear()
clear in interface CollectionUnsupportedOperationException - when removing from this List is not supportedisEmpty(),
size()boolean contains(Object object)
contains in interface Collectionobject - the object to search for
boolean containsAll(Collection collection)
containsAll in interface Collectioncollection - the Collection of objects
boolean equals(Object object)
equals in interface Collectionequals in class Objectobject - 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()Object get(int location)
location - the index of the element to return
IndexOutOfBoundsException - when location < 0 || >= size()int hashCode()
hashCode in interface CollectionhashCode in class Objectequals(java.lang.Object)int indexOf(Object object)
object - the object to search for
boolean isEmpty()
isEmpty in interface Collectionsize()Iterator iterator()
iterator in interface Collectioniterator in interface IterableIteratorint lastIndexOf(Object object)
object - the object to search for
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()boolean remove(Object object)
remove in interface Collectionobject - the object to remove
UnsupportedOperationException - when removing from this List is not supportedboolean removeAll(Collection collection)
removeAll in interface Collectioncollection - the Collection of objects to remove
UnsupportedOperationException - when removing from this List is not supportedboolean retainAll(Collection collection)
retainAll in interface Collectioncollection - the Collection of objects to retain
UnsupportedOperationException - when removing from this List is not supported
Object set(int location,
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()int size()
size in interface CollectionObject[] toArray()
toArray in interface CollectionObject[] toArray(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 | ||||||||