53 lines
1.5 KiB
Java
53 lines
1.5 KiB
Java
import java.util.Random;
|
|
public class test
|
|
{
|
|
public static void test1(){
|
|
Random r = new Random();
|
|
int[] arr = new int[5];
|
|
for (int i = 0; i < arr.length; i++){
|
|
arr[i] = r.nextInt();
|
|
}
|
|
LinkedList<Integer> test = new LinkedList(arr);
|
|
|
|
System.out.println(test);
|
|
System.out.println(test.erste());
|
|
System.out.println(test);
|
|
System.out.println(test.getNtenWert(2));
|
|
System.out.println(test.getNtenWert(23));
|
|
|
|
//LinkedList<String> test2 = new LinkedList<String>([{"Hallo", "Welt"}]);
|
|
|
|
|
|
}
|
|
public static void test2(){
|
|
Node<String> n = new Node<String>("Hallo");
|
|
Node<Integer> i = new Node<Integer>(5);
|
|
|
|
|
|
}
|
|
public static void testList(){
|
|
List<Integer> l = new List<Integer>();
|
|
l.add(1);
|
|
l.add(3);
|
|
l.remove(0);
|
|
System.out.println(l.get(0));
|
|
}
|
|
public static void testset(){
|
|
Set<Integer> test = new Set<Integer>();
|
|
for (int i = 0; i<20 ; i++){
|
|
test.add(i);
|
|
}
|
|
Set<Integer> s = new Set<Integer>();
|
|
for (int i = 11; i < 16; i++){
|
|
s.add(i);
|
|
}
|
|
System.out.println(test);
|
|
test.remove(2);
|
|
System.out.println(test);
|
|
System.out.println(test.subset(s));
|
|
System.out.println(test.difference(s));
|
|
System.out.println(test.union(s));
|
|
System.out.println(test.intersection(s));
|
|
}
|
|
}
|