package com.usr.collections;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class SetToList {
public static void main(String[] args) {
Set<String> set = new HashSet<String>();
set.add("sachin");
set.add("lara");
set.add("rohit");
set.add("kohile");
set.add("ashwin");
System.out.println("set objects are:" + set);
// converting set to list
List<String> list = new ArrayList<String>(set);
System.out.println("list objects are:" + list);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.