-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkedlist_Collection6.java
More file actions
59 lines (55 loc) · 1.51 KB
/
Copy pathLinkedlist_Collection6.java
File metadata and controls
59 lines (55 loc) · 1.51 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
47
48
49
50
51
52
53
54
55
56
57
58
59
package basicprograms;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Collections;
import java.util.Collection;
public class Linkedlist_Collection6 {
public static void main(String[] args) {
// TODO Auto-generated method stub
LinkedList l1=new LinkedList();
l1.add("Richa");
l1.add("Loomba");
l1.add("Kapoor");
l1.add("Mahima");
l1.add("Dahiya");
l1.add(1);
l1.add(132);
l1.add(1);
l1.add(132);
l1.add(132132);
l1.add(132132134);
l1.add(true);
l1.add('M');
l1.add(12.12);
l1.add(122.122);
l1.add(null);
l1.add(null);
l1.add(null);
l1.add(null);
/*
* l1.add("Richa"); l1.add("Loomba"); l1.add("Kapoor"); l1.add("Mahima");
* l1.add("Dahiya"); l1.add(1); l1.add(132); l1.add(1); l1.add(132);
* l1.add(132132); l1.add(132132134); l1.add(true); l1.add('M'); l1.add(12.12);
* l1.add(122.122); l1.add(null); l1.add(null); l1.add(null); l1.add(null);
*/
Object a=l1.getFirst();
System.out.println(a);
Object b=l1.getLast();
System.out.println(b);
Object c=l1.removeFirst();
System.out.println(c);
Object d=l1.removeLast();
System.out.println(d);
System.out.println("&&&&&&&&&&&&&&&&&");
System.out.println(l1);
/*
* Iterator it=l1.iterator();
*
* while(it.hasNext()==true) { System.out.println(it.next()); }
* System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
* ListIterator al=l1.listIterator(); while(al.hasNext()==true) {
* System.out.println(al.next()); }
*/
}
}