import java.util.HashSet;出力:
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.