SortedSet Interface Source Code Analysis

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.