SortedSet Interface for TreeSet preparation
You can implement a sorted collection
Source
Package Java.util;public Interface Sortedset<e> extends set<e> {/** * comparator */comparator<? su Per e> comparator (); /** * Get subset * @throws classcastexceptionif<tt>fromElement</tt> and* <tt>toElement</tt> cannot be compared toOne another using this *Set' s Comparator (or,if the SetHas no comparator, using * natural ordering). Implementations May, butIs notRequired * to, throw this exceptionif<tt>fromElement</tt>or* <tt>toElement</tt> cannot be compared toElements currentlyinch* the Set. * @throws NullPointerExceptionif<tt>fromElement</tt>or* <tt>toElement</tt> isNull andThisSet does notPermit NULL * elements * @throws illegalargumentexceptionif<tt>fromElement</tt> is*Greater than<tt>toElement</tt>;or ifThisSetitself * has a restricted range, and<tt>fromElement</tt>or* <tt>toElement</tt> lies outside theBounds of theRange */sortedset<e> subset (e fromelement, E toelement); /** * Gets a subset of strictly less than toelement * * @param toelement High endpoint (exclusive) of theReturnedSet* @returnA view of thePortion ofThisSet whoseElements is strictly *Less than<tt>toElement</tt> * @throws classcastexceptionif<tt>toElement</tt> is notCompatible * withThisSet' s Comparator (or,if the SetHas no comparator, *if<tt>toElement</tt>does notImplement {@link comparable}). * Implementations May, butIs notRequired to, Throw this * exceptionif<tt>toElement</tt> cannot be compared toElements * currentlyinch the Set. * @throws NullPointerExceptionif<tt>toElement</tt> isNull and* ThisSet does notPermit NULL elements * @throws illegalargumentexceptionifThisSetitself has a * restricted range, and<tt>toElement</tt> lies outside the* Bounds of theRange */sortedset<e> HeadSet (E toelement); /** * Get a subset greater than or equal to Fromelement * * @param fromelement Low endpoint (inclusive) of theReturnedSet* @returnA view of thePortion ofThisSet whoseElements is greater * thanor Equal to<tt>fromElement</tt> * @throws classcastexceptionif<tt>fromElement</tt> is notCompatible * withThisSet' s Comparator (or,if the SetHas no comparator, *if<tt>fromElement</tt>does notImplement {@link comparable}). * Implementations May, butIs notRequired to, Throw this * exceptionif<tt>fromElement</tt> cannot be compared toElements * currentlyinch the Set. * @throws NullPointerExceptionif<tt>fromElement</tt> isNULL * andThisSet does notPermit NULL elements * @throws illegalargumentexceptionifThisSetitself has a * restricted range, and<tt>fromElement</tt> lies outside the* Bounds of theRange */sortedset<e> Tailset (E fromelement); /** * First element * * @return the First(lowest) Element currentlyinchThisSet* @throws nosuchelementexceptionifThisSet isEmpty */E First(); /** * Last element * * @return the Last(highest) Element currentlyinchThisSet* @throws nosuchelementexceptionifThisSet isEmpty */E Last();}
SortedSet Interface Source Code Analysis