The Tree Set Class Java Help

The Tree Set Class
Tree Set provides an implementation of the Set interface that uses a tree-for storage.' Objects are storminess sorted, ascending order, Access and retrieval times are quite fast, . which makes Teri Set an excellent choice when storing large amounts of sorted information that must be found quickly.

The following constructors are defined:
Tree Set( )
Tree Set(Collection c)
Tree Set( Compactor comp)
Tree Set(Sorted Set 55)
The first form constructs an empty tree set that will be sorted in ascending order according to the natural order of its elements. The second form builds a tree set that contain's the elements of c. The third form constructs an empty tree set that will be sorted according to the compactor specified by camp. (Compactors are described later in this chapter.) The fourth form builds a tree set that contains the elements of S5. Here is an example that demonstrates a Tree Set The output from this program is shown here:
(A, B, C, D, E, F]
As explained, because Settle's stores its Clements in a tree, they are automatically 'arranged in sorted order, as~e output confirms

Posted on September 17, 2014 in java util Part 1 The Collections Framework

Share the Story

About the Author

Back to Top
Share This