T
- Data type of stored elements.public class SortedList<T extends Comparable<T>> extends 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
.modCount
Constructor and Description |
---|
SortedList()
Constructs an empty list with an initial capacity of ten.
|
SortedList(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(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(Collection<? extends T> c)
c
- Collection whose elements are to be added.public SortedList()
public T get(int index)
get
in interface List<T extends Comparable<T>>
get
in class AbstractList<T extends Comparable<T>>
public int size()
size
in interface Collection<T extends Comparable<T>>
size
in interface List<T extends Comparable<T>>
size
in class AbstractCollection<T extends Comparable<T>>
public boolean add(T e)
add
in interface Collection<T extends Comparable<T>>
add
in interface List<T extends Comparable<T>>
add
in class AbstractList<T extends Comparable<T>>
public T remove(int index)
remove
in interface List<T extends Comparable<T>>
remove
in class AbstractList<T extends Comparable<T>>
public int indexOf(Object o)
indexOf
in interface List<T extends Comparable<T>>
indexOf
in class AbstractList<T extends Comparable<T>>
Copyright © 2009-2013. All Rights Reserved.