| Author |
TreeSet and it's interface
|
Rajinder Yadav
Ranch Hand
Joined: Jan 18, 2002
Posts: 178
|
|
I'm reviewing collections, and of all the books I've read and other web-sites I come across all seem to indicate that the TreeSet implements the SortSet interface. While looking through JDK I came across this: "This class (java.util.TreeSet) implements the Set interface, backed by a TreeMap instance. ... " It this an error in the jdk doc? Can someone explain the anomalies here?
|
<a href="http://www.rajindery.com" target="_blank" rel="nofollow">Rajinder Yadav</a><p>Each problem that I solved became a rule which served afterwards to solve other problems. --Rene Descartes
|
 |
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
|
|
Actually it is backed by a SortedMap From the source:
|
SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
|
 |
Rajinder Yadav
Ranch Hand
Joined: Jan 18, 2002
Posts: 178
|
|
Great work Valetin, I guess the source code can't lie ... the ultimate reference So if I come across a ture/false type exam question asking if a TreeSet implements the SortSet interface I should answer false!  [ February 28, 2002: Message edited by: Rajinder Yadav ]
|
 |
swapna sivaraju
Ranch Hand
Joined: Jan 18, 2002
Posts: 75
|
|
Hi Yeah i also came across this confusing statement.. can anyone elaborate on this..... what does this mean--"-backed by TreeMap instance".. Swapna
|
SCPJ2
|
 |
 |
|
|
subject: TreeSet and it's interface
|
|
|