The Set Interface Java Help

The Set Interface .

Toe Set interface defines a set. It extends Collection and declares the behavior of a collection that does noT allow duplicate clements. Therefore, the add( ) method returns false if an attempt is made to add duplicate clements Loa set. It docs not define any additional methods of its own

The sortedset Interface
The SortedSet interface extends Set and declares the behavior of a set sorted in ascending order. in addition to those methods defined by Set, the SortedSet interface declares the methods summarized  Several methods throw a NoSuchElementException when no items arc contained in the invoking set. A ClaseCastbxccption is thrown when an object is incompatible with the elements in a set. A Nullpointerexception is thrown if an attempt is made to use a null object and nullis not allowed in the set. Sorted Set defines several methods that makeset processing more convenient. To obtain the first object i.n the set, call firstt ). To get the last clement, use lastl ), You can obtain a subset of a sorted set by calling sub Sett ), specifying the first and last object in the set. If you need the subset that starts with the first clement in the set, use headSet( ). If you want the subset that ends the set, use tailSel( ).

JavaHelpOnline.com

  • Feel free to send us an inquiry, we will reply back in hours.
 

Verification

Posted on September 17, 2014 in java util Part 1 The Collections Framework

Share the Story

About the Author

Back to Top