il.ac.tau.cs.software1.set
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)
          Returns true if this set contains the specified element.
 T getMaximum()
          Returns the maximal (highest) element in this set.
 T getMinimum()
          Returns the minimal (lowest) element in this set.
 boolean isEmpty()
          Returns true if this set contains no elements.
 SortedIterator<T> iterator()
          Returns an iterator over the elements of this set.
 int size()
          Returns the number of elements in this set (its cardinality).
 

Method Detail

size

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

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

contains

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

Returns:
true if this set contains the specified element

isEmpty

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

Returns:
true if this set contains no elements

getMinimum

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

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

getMaximum

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

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

iterator

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

Returns:
an iterator over the elements in this set