This repository has been archived by the owner on Jan 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListDemo.java
80 lines (54 loc) · 1.82 KB
/
ListDemo.java
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package list;
public class ListDemo {
public static void p(Object o) {System.out.println(o);} // shorthand notation
public static void main(String[] args) {
MultiColList list;
p("TEST TOSTRING\n");
list = new MultiColList("one","two","three","four","five","six","seven");
p(list);
p("\nTEST ADD\n");
list = new MultiColList("one","two","three","four");
list.add("dummy").add("dummy").add("dummy").add("dummy")
.add("dummy").add("dummy").add("dummy").add("dummy");
p(list);
p("\nTEST ADD TO EMPTY LIST\n");
p("\tSingle add:\n");
MultiColList emptylist = new MultiColList();
emptylist.add("dummy");
System.out.println(emptylist);
p("\tMultiple add:\n");
emptylist = new MultiColList();
emptylist.add("dummy", "dummy", "dummy", "dummy");
p(emptylist);
p("\nTEST REMOVE\n");
list = new MultiColList("one","two","three","remove me","four","five");
p(" Before remove:\n");
p(list);
p(" After remove:");
p(list.remove(4));
p("\nTEST CLEAR\n");
p(list);
p("""
list.clear();
p(list);
^ this yields V
""");
list.clear();
p(list);
p("(empty string)");
p("\nTEST VARIABLE HEIGHT\n");
p(" DEFAULT LENGTH IS 5:");
list = new MultiColList("dummy","dummy","dummy","dummy","dummy","dummy",
"dummy","dummy","dummy","dummy","dummy","dummy","dummy","dummy");
p(list);
p(" SET LENGTH TO 7:");
list.setVertical(7);
p(list);
p(" SET LENGTH TO 13:");
list.setVertical(13);
p(list);
p(" SET LENGTH TO 1:");
list.setVertical(1);
p(list);
}
}