This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HashSet

 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • 0
  • 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
  • 0
  • 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