Challenge: HashSet to TreeSet

Complete the conversion from HashSet to TreeSet challenge.

We'll cover the following

HashSet to TreeSet

Write Java code to convert a HashSet object to a TreeSet object. Remember that HashSet doesn’t contain sorted data, while TreeSet does.

Output the new TreeSet object named result_treeSet. Although the conversion from TreeSet to String is unnecessary, it should be done for output reasons.

Note: Don’t worry if you need help. You can see the solution by pressing the “Show Solution” button.

Get hands-on with 1200+ tech skills courses.