Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Difference between TreeSet and SortedSet

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello friends
what is the diff between treeset and sortedset?? ??
 
Saloon Keeper
Posts: 7089
165
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
TreeSet is a concrete class, whereas SortedSet is an interface (which happens to be implemented by TreeSet). Apart from that, their respective javadocs are quite different; what did you learn from studying those?
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

selvam kumar wrote:hello friends
what is the diff between treeset and sortedset?? ??



http://lmgtfy.com/?q=what+is+the+diff+between+treeset+and+sortedset
http://docs.oracle.com/javase/6/docs/api/java/util/TreeSet.html
http://docs.oracle.com/javase/6/docs/api/java/util/SortedSet.html

Please make an effort to do some research before posting to a forum. Then, if you're still confused, post more specific questions, referring back to the research you did as appropriate. You'll find this is a more productive and rewarding way to learn.

 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseAMeaningfulSubjectLine. "java" doesn't describe the problem. Wouldn't "Difference between TreeSet and SortedSet" be much more describing?
 
Marshal
Posts: 22441
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And that's what I've turned it to.
 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
NavigableSet is an interface that extends and replaces sortedset. TreeSet implements NavigableSet. Available since java SE 1.6
 
Rob Spoor
Marshal
Posts: 22441
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
NavigableSet doesn't replace SortedSet, it adds to it. If you want to create a Set implementation that doesn't need any of the methods added by NavigableSet then SortedSet is still the interface to implement.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wonder when TreeSet provides sorted set then why would we need SortedSet?
 
Rob Spoor
Marshal
Posts: 22441
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because there might be other implementations, like ConcurrentSkipListSet.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic