File tree Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .gaurav .ExProject .LinkedList ;
2
+
3
+ import java .util .LinkedList ;
4
+ /**
5
+ * A Java program to prove that LinkedList Allows null values
6
+ * @author coderolls.com
7
+ *
8
+ */
9
+ public class LinkedAllowDuplicates {
10
+
11
+ public static void main (String [] args ) {
12
+
13
+ LinkedList <String > linkedList = new LinkedList <String >();
14
+ linkedList .add ("John" );
15
+ linkedList .add (null );
16
+ linkedList .add ("Mark" );
17
+ linkedList .add (null );
18
+ linkedList .add ("Ruby" );
19
+ linkedList .add ("Lucy" );
20
+ linkedList .add ("Vikram" );
21
+ linkedList .add (null );
22
+
23
+ System .out .println (linkedList );
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ package com .gaurav .ExProject .LinkedList ;
2
+
3
+ import java .util .LinkedList ;
4
+ /**
5
+ * A Java program to prove that LinkedList Allows Duplicates
6
+ * @author coderolls.com
7
+ *
8
+ */
9
+ public class LinkedAllowNull {
10
+
11
+ public static void main (String [] args ) {
12
+
13
+ LinkedList <String > linkedList = new LinkedList <String >();
14
+ linkedList .add ("John" );
15
+ linkedList .add ("Mark" );
16
+ linkedList .add ("Mark" );
17
+ linkedList .add ("Mark" );
18
+ linkedList .add ("Ruby" );
19
+ linkedList .add ("Lucy" );
20
+ linkedList .add ("Vikram" );
21
+ linkedList .add ("Vikram" );
22
+
23
+ System .out .println (linkedList );
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ package com .gaurav .ExProject .LinkedList ;
2
+
3
+ import java .util .LinkedList ;
4
+ /**
5
+ * A Java program to prove that LinkedList maintains insertion order
6
+ * @author coderolls.com
7
+ *
8
+ */
9
+ public class LinkedListInsertionOrder {
10
+
11
+ public static void main (String [] args ) {
12
+
13
+ LinkedList <String > linkedList = new LinkedList <String >();
14
+ linkedList .add ("John" );
15
+ linkedList .add ("Mark" );
16
+ linkedList .add ("Ruby" );
17
+ linkedList .add ("Lucy" );
18
+ linkedList .add ("Vikram" );
19
+
20
+ System .out .println (linkedList );
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments