|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object AbstractSet<E> SortedSet<E>
public class SortedSet<E extends Comparable<? super E>>
In this implementation of the ISet interface the elements in the Set are maintained in ascending order. The data type for E must be a type that implements Comparable. Students are to implement methods that were not implemented in AbstractSet and override methods that can be done more efficiently. An ArrayList must be used as the internal storage container. For methods involving two set, if that method can be done more efficiently if the other set is also a SortedSet do so.
Constructor Summary | |
---|---|
SortedSet()
create an empty SortedSet |
|
SortedSet(ISet<E> other)
create a SortedSet out of an unsorted set. |
Method Summary | |
---|---|
E |
first()
Return the smallest element in this SortedSet. |
E |
last()
Return the largest element in this SortedSet. |
Methods inherited from class AbstractSet |
---|
toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ISet |
---|
add, addAll, clear, contains, containsAll, difference, equals, intersection, iterator, remove, size, union |
Constructor Detail |
---|
public SortedSet()
public SortedSet(ISet<E> other)
other
- != null, all elements in other implement Comparable
and they are mutually comparableMethod Detail |
---|
public E first()
public E last()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |