File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes HashSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "HashSet" Watch "HashSet" New topic
Author

HashSet

Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
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

Joined: Jul 03, 2001
Posts: 2120
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)

SCJP2. Please Indent your code using UBB Code
 
 
subject: HashSet