• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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?? ??
 
Bartender
Posts: 7645
178
  • 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?
 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus 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
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus 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
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus 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.
 
I brought this back from the farm where they grow the tiny ads:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic