Constructor and Description |
---|
BasicLinkedList()
Constructs an empty BasicLinkedList.
|
Modifier and Type | Method and Description |
---|---|
void |
add(E element)
Adds the element passed in to the end of the list with
O(1) performance.
|
void |
add(int index,
E 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.
|
BasicListIterator<E> |
basicListIterator()
Returns a reference to a BasicListIterator over the elements in this list
in the proper sequence (first-to-last order).
|
void |
clear()
Clears the list of its contents without walking the list.
|
boolean |
contains(E element)
Using the provided element's equals method, this method determines
if the list contains the specified element or not.
|
E |
get(int index)
Returns a reference to the element at the specified index.
|
int |
indexOf(E 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.util.Iterator<E> |
iterator()
Returns a reference to a java.util.Iterator over the elements of this
list in the proper sequence (first-to-last order).
|
E |
remove(int index)
Removes (and returns) the specified element from the list.
|
E |
set(int index,
E element)
Replaces the element at the specified index with the specified element.
|
int |
size()
Returns the number of elements in the list with O(1) performance.
|
public void add(E element)
public void add(int index, E element)
BasicList
public E get(int index)
BasicList
public int size()
public void clear()
public boolean contains(E element)
BasicList
public int indexOf(E element)
BasicList
public E remove(int index)
BasicList
public E set(int index, E element)
BasicList
public BasicListIterator<E> basicListIterator()
BasicList
basicListIterator
in interface BasicList<E>