import java.util.HashSet;Ausgabe:
import java.util.List;
import java.util.ArrayList;
public class ToArrayList{
public static void main(String[] args) {
// Erstellen eines HashSet
HashSethset = new HashSet ();
//Elemente zu HashSet hinzufügen
hset.add("java");
hset.add("C");
hset.add("C++");
hset.add("Ziel C");
hset.add("HTML/CSS");
// HashSet ausgeben
System.out.println("HashSet: "+ hset);
// Erstellen Sie eine ArrayList des generischen Typs String
//und übergeben Sie das Hashset als argument
ArrayListarraylist = new ArrayList (hset);
// print 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.