|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
public abstract class AbstractList
AbstractList is an abstract implementation of the List interface, optimized for a backing store which supports random access. This implementation does not support adding or replacing. A subclass must implement the abstract methods get() and size().
| Constructor Summary | |
|---|---|
protected |
AbstractList()
Constructs a new instance of this AbstractList. |
| Method Summary | |
|---|---|
void |
add(int location,
Object object)
Inserts the specified object into this List at the specified location. |
boolean |
add(Object object)
Adds the specified object at 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 |
equals(Object object)
Compares the specified object to this List and answer if they are equal. |
abstract 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. |
Iterator |
iterator()
Answers an Iterator on the elements of this List. |
Object |
remove(int location)
Removes the object at the specified location from this List. |
protected void |
removeRange(int start,
int end)
Removes the objects in the specified range from the start to the, but not including, end index. |
Object |
set(int location,
Object object)
Replaces the element at the specified location in this List with the specified object. |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, getClass, println |
| Methods inherited from interface java.util.List |
|---|
addAll, contains, containsAll, isEmpty, lastIndexOf, remove, removeAll, retainAll, size, toArray, toArray |
| Constructor Detail |
|---|
protected AbstractList()
| Method Detail |
|---|
public void add(int location,
Object object)
add in interface Listlocation - 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(Object object)
add in interface Collectionadd in interface Listadd in class AbstractCollectionobject - 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)
addAll in interface Listlocation - 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 void clear()
clear in interface Collectionclear in interface Listclear in class AbstractCollectionUnsupportedOperationException - when removing from this List is not supportedList#isEmpty,
List#sizepublic boolean equals(Object object)
equals in interface Collectionequals in interface Listequals in class Objectobject - the object to compare with this object
hashCode()public abstract Object get(int location)
get in interface Listlocation - the index of the element to return
IndexOutOfBoundsException - when location < 0 || >= size()public int hashCode()
hashCode in interface CollectionhashCode in interface ListhashCode in class Objectequals(java.lang.Object)public int indexOf(Object object)
indexOf in interface Listobject - the object to search for
public Iterator iterator()
iterator in interface Iterableiterator in interface Collectioniterator in interface Listiterator in class AbstractCollectionIteratorpublic Object remove(int location)
remove in interface Listlocation - the index of the object to remove
UnsupportedOperationException - when removing from this List is not supported
IndexOutOfBoundsException - when location < 0 || >= size()
protected void removeRange(int start,
int end)
start - the index at which to start removingend - the index one past the end of the range to remove
UnsupportedOperationException - when removing from this List is not supported
IndexOutOfBoundsException - when start < 0
public Object set(int location,
Object object)
set in interface Listlocation - 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()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||