public interface BasicList
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
java.lang.Object element)
Adds (inserts) the specfied element at the specfied index of the list
- note that it does not overwrite any existing data at that location.
|
void |
add(java.lang.Object element)
Adds the specfied element to the logical end of the list.
|
void |
clear()
Clears the list of its contents - the size of the list should be zero
and its capacity should be unaffected.
|
boolean |
contains(java.lang.Object element)
Using the provided element's equals method, this method determines
if the list contains the specified element or not.
|
java.lang.Object |
get(int index)
Returns a reference to the element at the specified index.
|
int |
indexOf(java.lang.Object element)
Using the provided element's equals method, this method returns the
index of the first element in the list that is equal to the provided
element, if any.
|
java.lang.Object |
remove(int index)
Removes (and returns) the specified element from the list.
|
java.lang.Object |
set(int index,
java.lang.Object element)
Sets (replaces) the element at the specfied index.
|
int |
size()
The logical size of the list (the number of elements that have been
added and not removed).
|
void add(java.lang.Object element)
element
- The element to add to the logical end of the list.void add(int index, java.lang.Object element)
index
- The index to add (insert) the specfied element.element
- The element to add (insert) to the speficfied position.java.lang.IndexOutOfBoundsException
- when the specified index is
negative or past the logical end of the list.void clear()
boolean contains(java.lang.Object element)
element
- The element to search for in the list.java.lang.Object get(int index)
index
- The index of the element you want to get.java.lang.IndexOutOfBoundsException
- Thrown when the specified index is
negative or past the logical end of the list.int indexOf(java.lang.Object element)
element
- The element to search for.java.util.NoSuchElementException
- if the list does not contain
the specified element.java.lang.Object remove(int index)
index
- The index of the element you want to remove.java.lang.IndexOutOfBoundsException
- Thown when the specified index is
negative or past the logical end of the list.java.lang.Object set(int index, java.lang.Object element)
index
- The index of the element whose you want to set (change).java.lang.IndexOutOfBoundsException
- Thown when the specified index is
negative or past the logical end of the list.int size()