-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinked_List_01.java
More file actions
35 lines (25 loc) · 790 Bytes
/
Copy pathLinked_List_01.java
File metadata and controls
35 lines (25 loc) · 790 Bytes
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
// Collection & FrameWork (LinkedList Implementation)
import java.util.Collections;
import java.util.LinkedList;
public class Linked_List_01 {
public static void main(String[] args){
LinkedList<Integer> list=new LinkedList<>();
list.add(1);
list.add(2);
list.add(3);
list.add(4);
list.addFirst(0);
list.addLast(5);
System.out.println(list);
list.removeFirst();
list.removeLast();
System.out.println(list);
list.remove(2);
System.out.println(list);
System.out.println(list.get(1));
System.out.println(list.size());
// Reversing the list using Collections.reverse() method
Collections.reverse(list);
System.out.println(list);
}
}