Java TreeSet clear() methodThe clear() method of TreeSet class is used to clear elements from the set and the set becomes empty. Syntax:Example 1Output: TreeSet: [ 1, 2, 5, 8, 10 ] TreeSet after clear: [] Example 2Output: TreeSet: [ A, B, a, b ] [ 1, 3, 6, 9 ] TreeSet after clear: [ A, B, a, b ] [ ] Next TopicJava-treeset-clone-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