-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestList.java
More file actions
48 lines (31 loc) · 1.05 KB
/
TestList.java
File metadata and controls
48 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package sjjg;
public class TestList {
public static void main(String a[]){
String[] values = {"A","B","C","D"};
//TestSeqList
/*SeqList<String> t1 = new SeqList<String>(values);
System.out.println(t1.get(0)); //测试get方法
t1.set(0, "a");
System.out.println(t1.get(0)); //测试set方法
System.out.println(t1.toString()); //测试toString方法
t1.insert(1, "b"); //测试插入
System.out.println(t1.toString());
t1.remove(1); //测试删除
System.out.println(t1.toString());
t1.clear(); //测试清空
System.out.println(t1.toString());
System.out.println("\n");*/
//TestSinglyList
SinglyList<String> t2 = new SinglyList<String>(values);
System.out.println(t2.get(0)); //测试get方法
t2.set(0, "a");
System.out.println(t2.get(0)); //测试set方法
System.out.println(t2.toString()); //测试toString方法
t2.insert(1, "b"); //测试插入
System.out.println(t2.toString());
t2.remove(1); //测试删除
System.out.println(t2.toString());
t2.clear(); //测试清空
System.out.println(t2.toString());
}
}