It's not a secret anymore!*
The moose likes Beginning Java and the fly likes Convert Set to List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Convert Set to List" Watch "Convert Set to List" New topic
Author

Convert Set to List

Chris Blackburn
Greenhorn

Joined: Mar 18, 2004
Posts: 3
I am using a java.util.Set with Hibernate, and I need to convert it to a java.util.List to output to my JSP pages.
Right now I am using an Iterator and .add() to my list. This is pretty ugly.
Is there a simpler way?
Thanks,
Chris
Chris Blackburn
Greenhorn

Joined: Mar 18, 2004
Posts: 3
Im sorry, its been a long night. I am trying to convert it to an java.util.ArrayList.
Chris
Chris Harris
Ranch Hand

Joined: Sep 21, 2003
Posts: 231
Hi Chris,
Welcome to the Java Ranch.
You could try:

Let us know if you have any problems with this.
Chris.


SCJP 1.2, SCWCD, SCBCD
Chris Blackburn
Greenhorn

Joined: Mar 18, 2004
Posts: 3
Works Perfect! Thnaks!
Chris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert Set to List