Java TreeSet iterator() MethodThe iterator() method of TreeSet class is used to get the elements in the increasing/ascending order from the Set. Syntax:Return:It returns an iterator of elements in increasing order. Example 1Output: TreeSet Element: 1 TreeSet Element : 2 TreeSet Element : 5 TreeSet Element : 8 TreeSet Element : 10 Example 2Output: TreeSet Element : A TreeSet Element : B TreeSet Element : a TreeSet Element : b Example 3Output: TreeSet: A 1 TreeSet: B 2 TreeSet: a 3 TreeSet: b 4 Next TopicJava-treeset-last-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