Java TreeSet first() methodThe first() method of TreeSet class is used to find smallest element of the set. Syntax:Return:Returns smallest element of the set Example 1Output: TreeSet: [ 2, 3, 5, 7, 10 ] Smallest element in TreeSet: 2 Example 2Output: TreeSet: [ D, P, g, q ] Smallest element in TreeSet: D Example 3Output: TreeSet: [ 1, 2, 3, 5, K, M, V, c ] Largest element in TreeSet: 1 Next TopicJava-treeset-floor-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India