File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TreeSet and it's interface

 
Rajinder Yadav
Ranch Hand
Posts: 178
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually it is backed by a SortedMap
From the source:
 
Rajinder Yadav
Ranch Hand
Posts: 178
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Yeah i also came across this confusing statement..
can anyone elaborate on this.....
what does this mean--"-backed by TreeMap instance"..
Swapna
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic