Java TreeSet last() methodThe last() method of TreeSet class is used to find largest element of the set. Syntax:Return:Returns largest element of the set Example 1Output: TreeSet: [ 2, 3, 5, 7, 10 ] largest element in TreeSet: 10 Example 2Output: TreeSet: [ D, P, g, q ] Smallest element in TreeSet: q Example 3Output: TreeSet: [ 1, 2, 3, 5, K, M, V, c ] Largest element in TreeSet: c Next TopicJava-treeset-lower-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