Modifier and Type | Method and Description |
---|---|
void |
add(int i,
E e)
Inserts the given element at the specified index of the list, shifting all
subsequent elements in the list one position further to make room.
|
E |
get(int i)
Returns (but does not remove) the element at index i.
|
boolean |
isEmpty()
Tests whether the list is empty.
|
Iterator<E> |
iterator()
Returns an iterator of the elements stored in the list.
|
E |
remove(int i)
Removes and returns the element at the given index, shifting all subsequent
elements in the list one position closer to the front.
|
E |
set(int i,
E e)
Replaces the element at the specified index, and returns the element previously stored.
|
int |
size()
Returns the number of elements in the list.
|
int size()
boolean isEmpty()
E get(int i) throws IndexOutOfBoundsException
i
- the index of the element to returnIndexOutOfBoundsException
- if the index is negative or greater than size()-1E set(int i, E e) throws IndexOutOfBoundsException
i
- the index of the element to replacee
- the new element to be storedIndexOutOfBoundsException
- if the index is negative or greater than size()-1void add(int i, E e) throws IndexOutOfBoundsException
i
- the index at which the new element should be storede
- the new element to be storedIndexOutOfBoundsException
- if the index is negative or greater than size()E remove(int i) throws IndexOutOfBoundsException
i
- the index of the element to be removedIndexOutOfBoundsException
- if the index is negative or greater than size()