1) Can anyone please explain or point me toward a tutorial that will explain and give examples of how the TreeSet accomplishes it's task? More specifically, what is the written out code behind the class that allows it to function?
2) Also, can TS be used to sort an unsorted array of strings?
Thanks so much!
EDIT: For (2), I am attempting to initialize a string String[] names = strings {junk names...} and have them lexicographically sorted. Is TS the correct call to make? Or is there another direction I should look.
In short TreeSet=
Tree(for ordering) + Set(for avoiding duplicates)
. In java Comparator/Comparable is used to compare two object in treesetFor Details,you need to have look at TreeSet source code . Here is the link Source Code