TreeSet()
Constructs a new, empty tree set, sorted according to the natural ordering of its elements.
That tells you how all elements will be sorted when they are added, rather than any special meaning for an empty set. It is actually grammatically ambiguous English, but there is more explanation if you click the blue text.Biniman Idugboe wrote:. . . sorted according to the natural ordering of its elements. . . .
Look in your Java® installation folder and you will find a file called src.zip. Unzip that into a new folder and navigate its Java subfolder, then util, the open the TreeSet.java file with a text editor; that will confirm what code is in its constructor.Biniman Idugboe wrote:. . . Please confirm, do these constructors have codes in them . . .
TreeSet(Collection<? extends E> c)
Constructs a new tree set containing the elements in the specified collection, sorted according to the natural ordering of its elements.
TreeSet(SortedSet<E> s)
Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.
“The strongest of all warriors are these two — Time and Patience.” ― Leo Tolstoy, War and Peace
“The strongest of all warriors are these two — Time and Patience.” ― Leo Tolstoy, War and Peace
Biniman Idugboe wrote:So, it looks like the src.zip was not installed along with Java in my system.
“The strongest of all warriors are these two — Time and Patience.” ― Leo Tolstoy, War and Peace
All things are lawful, but not all things are profitable.