• Post Reply Bookmark Topic Watch Topic
  • New Topic

TreeSet  RSS feed

 
Shahir Deo
Ranch Hand
Posts: 80
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Treeset is ordered and sorted , if it is sorted what is the use of or dered?
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not 100% sure but I think in this context "sorted" implies "ordered," so saying it's "sorted and ordered" is the same as saying it's "sorted."

Often the two are used interchangeably, but if you're curious, I bet if you do some searching, you'll be able to find a formal distinction between them. Maybe start with Total Ordering on Wikipedia, then Sorting on Wikipedia, then google the difference between ordering and sorting.

In the end though, it doesn't really mean anything that will affect your use of the class. Where did you read that its "ordered and sorted"?

 
Shahir Deo
Ranch Hand
Posts: 80
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the link.
Collection Table

and Jeff can you please tell what is NavigableSet and NavigableMap interfaces.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shahir Deo wrote:Here is the link.
Collection Table


Yeah, in that context, "ordered" appears to mean "there is a predictable iteration order", while sorted means, roughly, "the iteration order is defined by the elements, not the collection". So, as I stated, "sorted" implies "ordered".

and Jeff can you please tell what is NavigableSet and NavigableMap interfaces.


I would start with their javadocs and then if something in particular is not clear, ask a specific question here.

http://docs.oracle.com/javase/6/docs/api/java/util/NavigableMap.html
http://docs.oracle.com/javase/6/docs/api/java/util/NavigableSet.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!