• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HashSet

 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i think that HashSet doesn't specify any ordering while TreeSet does (as implementing SortedSet). is this correct??
and when we say that ordering may change over time, does that mean that in a program if i have a list then ordering may be different at different point of the program execution? is this so even if we don't change the list contents ever in the program once initialized??
regards
maulin.
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HashSet doesn't impose any order as TreeSet does.
For changing the sequence of a List:
Collections.reverse(list)
Collections.suffle(list)
Collections.sort(list)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic