wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes how come Set is not sortable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how come Set is not sortable" Watch "how come Set is not sortable" New topic
Author

how come Set is not sortable

Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
hello,

i was just wondering how come a List object is sortable using Collections.sort but a Set is not?


JDBCSupport - An easy to use, light-weight JDBC framework -
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
Why not just use a SortedSet?

John.
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
cuz i didnt know it exists ;)
thank you
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11256
    
  16

A set in Mathematics by definition has no order. sometimes you may want a set that doesn't have the overhead of sorting.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how come Set is not sortable