-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMain.java
More file actions
22 lines (18 loc) · 788 Bytes
/
Main.java
File metadata and controls
22 lines (18 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class Main {
public static void main(String[] args) {
LinkedList<Integer> linkedList = new LinkedList<>();
LinkedListDummyHead<Integer> linkedListDummyHead = new LinkedListDummyHead<>();
for (int i = 0; i < 5; i++) {
linkedList.addFirst(i);
linkedListDummyHead.addFirst(i);
System.out.println("LinkedList: " + linkedList);
System.out.println("linkedListDummyHead: " + linkedListDummyHead);
}
linkedList.add(2, 666);
linkedListDummyHead.add(2, 666);
System.out.println("LinkedList: " + linkedList);
System.out.println("linkedListDummyHead: " + linkedListDummyHead);
linkedListDummyHead.remove(2);
System.out.println(linkedListDummyHead);
}
}