-
Notifications
You must be signed in to change notification settings - Fork 0
/
newLL.java
36 lines (33 loc) · 1.08 KB
/
newLL.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
import java.util.LinkedList;
public class newLL {
public static void main(String[] args) {
LinkedList<String> list=new LinkedList<String>();
LinkedList<String> list2=new LinkedList<String>();
list2.add("Mircosoft Intern 2023");
list2.addFirst("engage program");
for (int i = 0; i < list2.size(); i++) {
System.out.print(list2.get(i)+"->");
}
System.out.println("null");
list.addFirst(" romil");
list.addLast(" movaliya");
list.addFirst("mr.");
for(int i=0;i<list.size();i++){
System.out.print(list.get(i)+"->");
}
System.out.println("Null");
list.add("devOps engineer");
System.out.println(list);
list.remove(3);
System.out.println(list);
System.out.println(list.isEmpty());
list.addAll(list2);
System.out.println(list);
list.removeFirst();
System.out.println(list);
list.removeLast();
System.out.println(list);
list.clear();
System.out.print(list);
}
}