|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
net.sourceforge.nite.util.SortedList
public class SortedList
This class implements a sorted list. It is constructed with a comparator that can compare two objects and sort objects accordingly. When you add an object to the list, it is inserted in the correct place. Object that are equal according to the comparator, will be in the list in the order that they were added to this list. Add only objects that the comparator can compare.
Constructor Summary | |
---|---|
SortedList(java.util.Comparator c)
Constructs a new sorted list. |
Method Summary | |
---|---|
void |
add(int index,
java.lang.Object element)
This method has no effect. |
boolean |
add(java.lang.Object o)
Adds an object to the list. |
Methods inherited from class java.util.ArrayList |
---|
addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, removeAll, retainAll, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList |
Constructor Detail |
---|
public SortedList(java.util.Comparator c)
Constructs a new sorted list. The objects in the list will be sorted according to the specified comparator.
c
- a comparatorMethod Detail |
---|
public void add(int index, java.lang.Object element)
This method has no effect. It is not allowed to specify an index to insert an element as this might violate the sorting order of the objects in the list.
add
in interface java.util.List
add
in class java.util.ArrayList
public boolean add(java.lang.Object o)
Adds an object to the list. The object will be inserted in the correct place so that the objects in the list are sorted. When the list already contains objects that are equal according to the comparator, the new object will be inserted immediately after these other objects.
add
in interface java.util.Collection
add
in interface java.util.List
add
in class java.util.ArrayList
o
- the object to be added
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |