public interface SortedList<T extends java.lang.Comparable<? super T>>
extends java.lang.Iterable<T>
Modifier and Type | Method and Description |
---|---|
void |
add(T item)
Adds item to the list in sorted order.
|
void |
clear()
Removes all of the elements from this list.
|
boolean |
contains(T targetItem)
Returns true if this list contains the specified element.
|
T |
get(int position)
Returns the element at the specified position in this list.
|
int |
indexOf(T targetItem)
Returns the position of the item, or -1 if item is not in the list.
|
boolean |
isEmpty()
Returns true if this list contains no elements.
|
java.util.Iterator<T> |
iterator()
Returns an iterator over the elements in this list in proper sequence.
|
T |
remove(int i)
Removes the element at the specified position in this list.
|
boolean |
remove(T targetItem)
Removes the specified element from this list, if it is present.
|
int |
size()
Returns the number of elements in this list.
|
java.lang.Object[] |
toArray()
Returns an array version of the list.
|
void add(T item)
item
- element to be added to the listboolean remove(T targetItem)
targetItem
- element to be removed from this list, if presentT remove(int i)
i
- index of the element to be removedjava.lang.IndexOutOfBoundsException
- if the index is out of bounds.int indexOf(T targetItem)
targetItem
- itemT get(int position)
position
- specified positionjava.lang.IndexOutOfBoundsException
- if the index is out of bounds.boolean contains(T targetItem)
targetItem
- specified elementint size()
boolean isEmpty()
void clear()
java.lang.Object[] toArray()
java.util.Iterator<T> iterator()