SortedSet
- It is the child interface set.
- If we want to represent a group of objects without duplicates, according to some sorting order, then we should go for SortedSet interface.
- The sorting order can be natural sorting order or customized sorting order.
- SortedSet defines the following six specific methods.
- Object first ();
- Object last ();
- SortedSet headset (object o ) // returns sortedset, whose elements are less than the specified object.
- SortedSet tailset ( object o )// returns the SortedSet, whose elements are greater than or equal to object.
- SortedSet subset ( object 01, object 02 ) ; // returns the SortedSet, whose elements are greater than or equal to 01 & less than 02.
- Comparator comparator () // returns the Comparator object, that describes underlying sorting techniques. If we are depending on natural sorting order, then this method returns null
- First () → 100
- Last () → 106
- Headset ( 103 ) → 100, 101, 102
- Tailset ( 103 ) → 103,104,105,106
- Subset ( 100,105 ) → 101,102,103,104
- Comparator () → null
Hello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in the IT industry for more than 12 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting, Website Development, and IAM(ForgeRock) Specialist
I am a self-learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.