-
Notifications
You must be signed in to change notification settings - Fork 28
/
DynamicArrayDemo.java
49 lines (37 loc) · 1.04 KB
/
DynamicArrayDemo.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
package ds_003_arrays;
public class DynamicArrayDemo {
public static void main(String[] args) {
DynamicArray<Integer> array = new DynamicArray<>();
array.printArray();
array.add(10);
array.add(new Integer[] {20, 30, 40});
array.printArray();
array.printState();
array.add(50);
array.printArray();
array.printState();
Integer removed = array.removeTail();
System.out.println("\t\tRemoved: " + removed);
array.printArray();
array.printState();
removed = array.removeTail();
System.out.println("\t\tRemoved: " + removed);
array.printArray();
array.printState();
removed = array.removeTail();
System.out.println("\t\tRemoved: " + removed);
array.printArray();
array.printState();
removed = array.removeTail();
System.out.println("\t\tRemoved: " + removed);
array.printArray();
array.printState();
removed = array.removeTail();
System.out.println("\t\tRemoved: " + removed);
array.printArray();
array.printState();
array.add(1);
array.printArray();
array.printState();
}
}