-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
46 lines (40 loc) · 1.12 KB
/
Copy pathMain.java
File metadata and controls
46 lines (40 loc) · 1.12 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
package arrayList;
import java.util.ArrayList;
import java.util.LinkedList;
public class Main {
public static void main(String[] args) {
MyArrayList<Integer> arr = new MyArrayList<Integer>();
arr.add(0, 0);
arr.add(1, 7);
arr.add(12);
arr.add(3);
arr.add(5);
arr.add(28);
arr.add(14);
arr.add(10);
arr.trimToSize();
// System.out.println(arr.toString());
// System.out.println(arr.getData(2));
// System.out.println(arr.subList(2, 5));
// for (int i = 0; i < arr.size() ; i++) {
// System.out.println("index is " + i + " element is " + arr.getData(i));
// }
// System.out.println(arr.toString());
// System.out.println(arr.toArray());
//System.out.println(arr.clone());
// ArrayList<Integer> test = new ArrayList<Integer>();
// LinkedList<Integer> test2 = new LinkedList<Integer>();
// test2.add(25);
// System.out.println(arr.addAll(5,test2));
// test.add(1);
// test.add(151);
// System.out.println(test.toString());
// test.add(150);
// test.add(15);
// test2.add(17);
// test2.add(18);
// test.addAll(1, test2);
// test.subList(0, 2);
// //System.out.println(test.listIterator());
}
}