il.ac.tau.cs.sw1.sortedset
Interface SortedSet<T extends java.lang.Comparable<T>>

All Known Implementing Classes:
BinaryOpSortedSet, SimpleSortedSet

public interface SortedSet<T extends java.lang.Comparable<T>>

A Set that provides a total ordering on its elements. The elements are ordered using their natural ordering. All elements inserted into a sorted set must implement the Comparable interface. The set's iterator will traverse the set in ascending element order.


Method Summary
 boolean contains(T element)
          Return true if this set contains the specified element.
 T getMaximum()
          Return the maximal (highest) element in this set.
 T getMinimum()
          Return the minimal (lowest) element in this set.
 boolean isEmpty()
          Return true if this set contains no elements.
 SortedIterator<T> iterator()
          Return an iterator over the elements of this set.
 int size()
          Return the number of elements in this set (its cardinality).
 

Method Detail

contains

boolean contains(T element)
Return true if this set contains the specified element.

Returns:
true if this set contains the specified element

getMaximum

T getMaximum()
Return the maximal (highest) element in this set.

Returns:
the maximal (highest) element in this set
Throws:
NoSuchElementException - - if this set is empty

getMinimum

T getMinimum()
Return the minimal (lowest) element in this set.

Returns:
the minimal (lowest) element in this set
Throws:
NoSuchElementException - - if this set is empty

isEmpty

boolean isEmpty()
Return true if this set contains no elements.

Returns:
true if this set contains no elements

iterator

SortedIterator<T> iterator()
Return an iterator over the elements of this set. The elements are returned in ascending order.

Returns:
an iterator over the elements in this set

size

int size()
Return the number of elements in this set (its cardinality).

Returns:
the number of elements in this set (its cardinality)