import java.util.*;
public class ConvertSet2List{
public static void main(String[] args) {
Set<Object> set = new HashSet<Object>();
set.add("JavaStuff.in");
set.add(new Long(5));
set.add(new Date());
set.add(6);
/*Convert the Set to a List can be done by passing the Set
instance into the constructor of a List implementation class such as ArrayList. */
List<Object> list = new ArrayList<Object>(set);
for (int i = 0; i < list.size(); i++) {
Object o = list.get(i);
System.out.println("Object = " + o);
}
}
}
public class ConvertSet2List{
public static void main(String[] args) {
Set<Object> set = new HashSet<Object>();
set.add("JavaStuff.in");
set.add(new Long(5));
set.add(new Date());
set.add(6);
/*Convert the Set to a List can be done by passing the Set
instance into the constructor of a List implementation class such as ArrayList. */
List<Object> list = new ArrayList<Object>(set);
for (int i = 0; i < list.size(); i++) {
Object o = list.get(i);
System.out.println("Object = " + o);
}
}
}