diff --git a/LinkedHash17a.class b/LinkedHash17a.class new file mode 100644 index 0000000..3823bc5 Binary files /dev/null and b/LinkedHash17a.class differ diff --git a/LinkedHash17a.java b/LinkedHash17a.java new file mode 100644 index 0000000..7a0f4ae --- /dev/null +++ b/LinkedHash17a.java @@ -0,0 +1,16 @@ +// 17a) Write a java code to demonstrate LinkedHashSet + +import java.util.*; +public class LinkedHash17a{ + public static void main(String args[]){ + LinkedHashSet pc = new LinkedHashSet(); + pc.add("RAM stick"); + pc.add("GPU"); + pc.add("RAM stick"); + pc.add("Processor"); + Iterator itr = pc.iterator(); + while(itr.hasNext()){ + System.out.println(itr.next()); + } + } +} \ No newline at end of file diff --git a/LinkedHash17b.class b/LinkedHash17b.class new file mode 100644 index 0000000..761eadf Binary files /dev/null and b/LinkedHash17b.class differ diff --git a/LinkedHash17b.java b/LinkedHash17b.java new file mode 100644 index 0000000..441c755 --- /dev/null +++ b/LinkedHash17b.java @@ -0,0 +1,15 @@ +import java.util.*; +public class LinkedHash17b{ + public static void main(String args[]){ + LinkedHashSet pc = new LinkedHashSet(); + pc.add("RAM stick"); + pc.add("GPU"); + pc.add(""); + pc.add("RAM stick"); + pc.add("Processor"); + Iterator itr = pc.iterator(); + while(itr.hasNext()){ + System.out.println(itr.next()); + } + } +} \ No newline at end of file diff --git a/LinkedHash17c.class b/LinkedHash17c.class new file mode 100644 index 0000000..758b9ae Binary files /dev/null and b/LinkedHash17c.class differ diff --git a/LinkedHash17c.java b/LinkedHash17c.java new file mode 100644 index 0000000..cd8b362 --- /dev/null +++ b/LinkedHash17c.java @@ -0,0 +1,15 @@ +import java.util.*; +public class LinkedHash17c{ + public static void main(String args[]){ + LinkedHashSet pc = new LinkedHashSet(); + pc.add("RAM stick"); + pc.add("GPU"); + pc.add(null); + pc.add("RAM stick"); + pc.add("Processor"); + Iterator itr = pc.iterator(); + while(itr.hasNext()){ + System.out.println(itr.next()); + } + } +} \ No newline at end of file diff --git a/LinkedList13b.class b/LinkedList13b.class new file mode 100644 index 0000000..32108de Binary files /dev/null and b/LinkedList13b.class differ diff --git a/LinkedList13b.java b/LinkedList13b.java new file mode 100644 index 0000000..eb6ddf8 --- /dev/null +++ b/LinkedList13b.java @@ -0,0 +1,16 @@ +import java.util.*; + +public class LinkedList13b { + public static void main(String args[]){ + LinkedList name = new LinkedList(); + name.add("Misa"); + name.add("Aditya"); + name.add("Misa"); + name.add("Aisha"); + Iterator itr = name.iterator(); + while(itr.hasNext()){ + System.out.println(itr.next()); + } + } +} + diff --git a/LinkedListDemo.java b/LinkedListDemo.java new file mode 100644 index 0000000..a394144 --- /dev/null +++ b/LinkedListDemo.java @@ -0,0 +1,26 @@ +// 13. write a java program to demonstrate Linked List + +import java.util.LinkedList; + +public class LinkedListDemo { + public static void main(String[] args) { + + LinkedList linkedList = new LinkedList<>(); + + linkedList.add("Element A"); + linkedList.add("Element B"); + linkedList.add("Element C"); + + System.out.println("Element at index 0: " + linkedList.get(0)); + System.out.println("Element at index 1: " + linkedList.get(1)); + System.out.println("Element at index 2: " + linkedList.get(2)); + + System.out.println("LinkedList Elements:"); + for (String element : linkedList) { + System.out.println(element); + } + + linkedList.remove("Element B"); + System.out.println("Size of linked list after removal: " + linkedList.size()); + } +} \ No newline at end of file diff --git a/Stack15.class b/Stack15.class new file mode 100644 index 0000000..54cdf06 Binary files /dev/null and b/Stack15.class differ diff --git a/Stack15.java b/Stack15.java new file mode 100644 index 0000000..cf47a2b --- /dev/null +++ b/Stack15.java @@ -0,0 +1,25 @@ +// write a java code to demonstrate Stack +import java.util.*; +public class Stack15 { + public static void main(String ar[]){ + Stack elec = new Stack(); + elec.push("fan"); + elec.push("air conditioner"); + elec.push("computer"); + elec.push("iron"); + elec.push("lights"); + + Iterator itr = elec.iterator(); + while(itr.hasNext()){ + System.out.println(itr.next()); + } + String topOfStack = elec.peek(); + System.out.println("The top electrical item is : " + topOfStack); + elec.pop(); + System.out.println("After Pop : "); + Iterator newItr = elec.iterator(); + while(newItr.hasNext()){ + System.out.println(newItr.next()); + } + } +} \ No newline at end of file diff --git a/TreeSet18a.class b/TreeSet18a.class new file mode 100644 index 0000000..c3c7d5f Binary files /dev/null and b/TreeSet18a.class differ diff --git a/TreeSet18a.java b/TreeSet18a.java new file mode 100644 index 0000000..d875b18 --- /dev/null +++ b/TreeSet18a.java @@ -0,0 +1,15 @@ +// write a java code to demonstrate treeset +import java.util.*; +public class TreeSet18a { + public static void main(String args[]){ + TreeSet home = new TreeSet(); + home.add("Hall Room"); + home.add("Bed Room"); + home.add("Bed Room"); + home.add("Kitchen"); + Iterator itr = home.iterator(); + while(itr.hasNext()){ + System.out.println(itr.next()); + } + } +} \ No newline at end of file diff --git a/TreeSet18b.class b/TreeSet18b.class new file mode 100644 index 0000000..37e935c Binary files /dev/null and b/TreeSet18b.class differ diff --git a/TreeSet18b.java b/TreeSet18b.java new file mode 100644 index 0000000..c267ebf --- /dev/null +++ b/TreeSet18b.java @@ -0,0 +1,16 @@ +// write a java code to demonstrate treeset +import java.util.*; +public class TreeSet18b { + public static void main(String args[]){ + TreeSet home = new TreeSet(); + home.add("Hall Room"); + home.add("Bed Room"); + home.add(null); + home.add("Bed Room"); + home.add("Kitchen"); + Iterator itr = home.iterator(); + while(itr.hasNext()){ + System.out.println(itr.next()); + } + } +} \ No newline at end of file diff --git a/Vector14a.class b/Vector14a.class new file mode 100644 index 0000000..10e7484 Binary files /dev/null and b/Vector14a.class differ diff --git a/Vector14a.java b/Vector14a.java new file mode 100644 index 0000000..5f05a78 --- /dev/null +++ b/Vector14a.java @@ -0,0 +1,16 @@ +// write a java code to demonstrate vector (a) + +import java.util.*; +public class Vector14a { + public static void main(String ar[]){ + Vector names = new Vector(); + names.add("Misa"); + names.add("Aditya"); + names.add("Ashish"); + names.add("Garima"); + Iterator itr = names.iterator(); + while(itr.hasNext()){ + System.out.println(itr.next()); + } + } +} \ No newline at end of file diff --git a/Vector14b.class b/Vector14b.class new file mode 100644 index 0000000..b9f97d1 Binary files /dev/null and b/Vector14b.class differ diff --git a/Vector14b.java b/Vector14b.java new file mode 100644 index 0000000..612aa9a --- /dev/null +++ b/Vector14b.java @@ -0,0 +1,22 @@ +import java.util.Vector; +public class Vector14b { + public static void main(String args[]){ + Vector itemList = new Vector(); + itemList.add("Item A"); + itemList.add("Item B"); + itemList.add("Item C"); + + System.out.println("Item at index 0: " + itemList.get(0)); + System.out.println("Item at index 1: " + itemList.get(1)); + System.out.println("Item at index 2: " + itemList.get(2)); + + System.out.println("Items in Vector list: "); + for(String item: itemList) { + System.out.println(item); + } + + itemList.remove("Item B"); + System.out.println("Size of Vector after removal: " + itemList.size()); + } +} + diff --git a/hashSet16.class b/hashSet16.class new file mode 100644 index 0000000..a428f34 Binary files /dev/null and b/hashSet16.class differ diff --git a/hashSet16.java b/hashSet16.java new file mode 100644 index 0000000..f8fad9a --- /dev/null +++ b/hashSet16.java @@ -0,0 +1,18 @@ +// Write a java code to demonstrate hashSet + +import java.util.*; +public class hashSet16 { + public static void main(String args[]){ + HashSet setName = new HashSet(); + setName.add("Misa"); + setName.add("Aditya"); + setName.add("Misa"); + setName.add("Ravi"); + + Iterator itr = setName.iterator(); + while(itr.hasNext()){ + System.out.println(itr.next()); + } + } +} + diff --git a/src/13b.png b/src/13b.png new file mode 100644 index 0000000..5b9d81a Binary files /dev/null and b/src/13b.png differ diff --git a/src/14a.png b/src/14a.png new file mode 100644 index 0000000..3fac861 Binary files /dev/null and b/src/14a.png differ diff --git a/src/14b.png b/src/14b.png new file mode 100644 index 0000000..8f13ab8 Binary files /dev/null and b/src/14b.png differ diff --git a/src/15.png b/src/15.png new file mode 100644 index 0000000..9215577 Binary files /dev/null and b/src/15.png differ diff --git a/src/16.png b/src/16.png new file mode 100644 index 0000000..26be815 Binary files /dev/null and b/src/16.png differ diff --git a/src/17a.png b/src/17a.png new file mode 100644 index 0000000..e0650ea Binary files /dev/null and b/src/17a.png differ diff --git a/src/17b.png b/src/17b.png new file mode 100644 index 0000000..688eb14 Binary files /dev/null and b/src/17b.png differ diff --git a/src/17c.png b/src/17c.png new file mode 100644 index 0000000..9b8b4c8 Binary files /dev/null and b/src/17c.png differ diff --git a/src/18a.png b/src/18a.png new file mode 100644 index 0000000..1e67ec3 Binary files /dev/null and b/src/18a.png differ diff --git a/src/18b.png b/src/18b.png new file mode 100644 index 0000000..9dc22ea Binary files /dev/null and b/src/18b.png differ