Browse - Programming Tips - How can I convert a HashSet into an ArrayList ?

Date: 2012nov8
Language: Java

Q.  How can I convert a HashSet into an ArrayList ?

A.  There is a constructor of ArrayList that does that.
For example:

HashSet<String> myset = new HashSet<String>(); myset.add("one"); myset.add("two"); ArrayList<String> mylist = new ArrayList<String>(myset); // CONVERT