T
- Data type of stored elements.public class SortedList<T extends java.lang.Comparable<T>>
extends java.util.AbstractList<T>
List
interface that automatically
sorts all values. It implements the methods get
, size
,
add
, and size
. The stored elements must implement the
interface Comparable
.Constructor and Description |
---|
SortedList()
Constructs an empty list with an initial capacity of ten.
|
SortedList(java.util.Collection<? extends T> c)
Constructs a list containing the elements of the specified collection.
|
SortedList(int initialCapacity)
Constructs an empty list with the specified initial capacity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T e) |
T |
get(int index) |
int |
indexOf(java.lang.Object o) |
T |
remove(int index) |
int |
size() |
add, addAll, clear, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
public SortedList(int initialCapacity)
initialCapacity
- Initial capacity of the list.public SortedList(java.util.Collection<? extends T> c)
c
- Collection whose elements are to be added.public SortedList()