|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wisc.cs.util.SortedList
Implements a list object which supports order perserving insertions and duplicate elements. This class is implemented as a doubly linked list, so that inserts do not require shifting of array elements.
Constructor Summary | |
SortedList()
Constructs a new SortedList with the default comparator which sorts in ascending order. |
|
SortedList(boolean rev)
Constructs a new SortedList with the default comparator which sorts in the specified order. |
|
SortedList(java.util.Comparator c)
Constructs a new SortedList with the specified comparator which sorts in ascending order. |
|
SortedList(java.util.Comparator c,
boolean rev)
Constructs a new SortedList with the specified comparator which sorts in the specified order. |
Method Summary | |
void |
clear()
Removes all of the elements in the list. |
void |
insert(java.lang.Object o)
Adds an object to the sorted list in a position specified by the partial order imposed by a comparator. |
boolean |
isReversed()
Returns true if the list is in reverse sorted order, false otherwise. |
PeekIterator |
iterator()
Returns an iterator containing all of the elements in sorted order. |
int |
size()
Returns the number of elemets in the list. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SortedList()
public SortedList(boolean rev)
rev
- true to sort in reversed order, false for ascending order.public SortedList(java.util.Comparator c)
c
- the comparator to use in item comparisons.public SortedList(java.util.Comparator c, boolean rev)
c
- the comparator to use in item comparisons.rev
- true to sort in reversed order, false for ascending order.Method Detail |
public boolean isReversed()
public PeekIterator iterator()
public int size()
public void clear()
public void insert(java.lang.Object o)
o
- an object to insert into the list.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |