Java Set convert to List

Description

Java Set convert to List



        /*w  ww . ja  v  a  2  s. c  o m*/
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) {
    Set<String> set = new HashSet<String>();
    set.add("CSS");
    set.add("HTML");
    set.add("Java");

    List<String> list = new ArrayList<String>(set);
    System.out.println(list);
    
  }
}



PreviousNext

Related