Java List convert to Set
import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class Main { public static void main(String[] args) { List<String> myList = new ArrayList<String>(); myList.add("CSS"); myList.add("HTML"); myList.add("C++"); myList.add("Dart"); Set<String> mySet = new HashSet<String>(myList); System.out.println(mySet);// w w w . j av a 2 s .c o m } }