public interface ListInterface<I extends java.lang.Comparable<? super I>>
| Modifier and Type | Method and Description |
|---|---|
void |
add(I element)
This method is called to add the specified Element to the end of the list.
|
boolean |
add(I element,
int index)
This method is called to add the specified Element to the list at the given index.
|
void |
addSorted(I element)
This method is called to add the specified Element to the list in sorted order.
|
I |
get(int index)
This method is called to retrieve the Element at the specified index.
|
boolean |
isEmpty()
This method is called to determine if the list is empty.
|
boolean |
remove(int index)
This method is called to remove the Element at the specified index
|
void |
removeAll()
This method removes all Elements from the list, making the list empty.
|
I |
replace(I element,
int index)
This method is called to replace the element at the specified index with the specified
obj.
|
int |
size()
This method is called to obtain the count of elements in the list.
|
int size()
boolean isEmpty()
void add(I element)
element - A reference to the element to be added to the end of the list.
All Elements being added to the list must implement the
Comparable interface.Comparableboolean add(I element, int index)
element - A reference to the element to be added to the list.
All Elements being added to the list must implement the
Comparable interface.index - Indicates the position at which to add the specified Element.
Using and index = 0, indicates that the Element being added should
become the head of the list and should succeed even if
the list is currently empty.Comparablevoid addSorted(I element)
element - A reference to the element being added, in sorted order,
to the list. All Elements being added to the list must implement the
Comparable interface.ComparableI get(int index)
index - Indicates the position from which to retrieve the Element.I replace(I element, int index)
element - A reference to the element that will replace the current element in the list.index - Idicates the position in the list where the replacement should be made.boolean remove(int index)
index - Indicates the position from which to remove the Element.void removeAll()