import java.util.HashSet;Output:
import java.util.List;
import java.util.ArrayList;
public class ToArrayList{
public static void main(String[] args) {
// HashSet 생성
HashSethset = new HashSet ();
//HashSet에 요소 추가
hset.add("java");
hset.add("C");
hset.add("C++");
hset.add("목표 C");
hset.add("HTML/CSS");
// HashSet
System.out.println("HashSet: "+ hset);
// 제네릭 유형의 ArrayList를 만듭니다. String
//해시셋을 인수로 전달합니다
ArrayListarraylist = new ArrayList (hset);
// ArrayList
System.out.println("ArrayList: "+ arraylist);
}
}
HashSet: [HTML/CSS, C, java, Objective C, C++]
ArrayList: [HTML/CSS, C, java, Objective C, C++]
Please disable your ad blocker and refresh the window to use this website.