├── README.md ├── bin └── com │ └── w3epic │ └── wiprotraining │ ├── assignment1 │ └── Assignment1.class │ ├── assignment2 │ ├── assignment2.class │ ├── bean │ │ ├── Employee.class │ │ └── EmployeeDB.class │ └── service │ │ └── MainTest.class │ ├── assignment3 │ └── Assignment3.class │ ├── assignment4 │ ├── Assignment4.class │ └── MyArrayList.class │ ├── assignment5 │ ├── Assignment5.class │ └── Employee.class │ ├── assignment6 │ └── Assignment6.class │ ├── assignment7 │ └── Assignment7.class │ └── assignment8 │ ├── Assignment8.class │ └── Employee.class └── src └── com └── w3epic └── wiprotraining ├── assignment1 └── Assignment1.java ├── assignment2 ├── assignment2.java ├── bean │ ├── Employee.java │ └── EmployeeDB.java └── service │ └── MainTest.java ├── assignment3 └── Assignment3.java ├── assignment4 └── Assignment4.java ├── assignment5 └── Assignment5.java ├── assignment6 └── Assignment6.java ├── assignment7 └── Assignment7.java └── assignment8 └── Assignment8.java /README.md: -------------------------------------------------------------------------------- 1 | Wipro TalentNext PBL 2 | 3 | Topics Covered Hands-on Assignments for List 4 | 5 | No. Hands-on Assignment Topics Covered Status 6 | 7 | 1 8 | 9 | Develop a java class with a method saveEvenNumbers(int N) using ArrayList to store even numbers from 2 to N, where N is a integer which is passed as a parameter to the method saveEvenNumbers(). 10 | The method should return the ArrayList (A1) created. In the same class create a method printEvenNumbers()which iterates through the arrayList A1 in step 1, and It should multiply each number with 2 and display it in format 4,8,12….2*N. and add these numbers in a new ArrayList (A2). 11 | The new ArrayList (A2) created needs to be returned. Create a method printEvenNumber(int N) parameter is a number N. This method should search the arrayList (A1) for the existence of the number ‘N’ passed. If exists it should return the Number else return zero.Hint: Use instance variable for storing the ArrayList A1 and A2. 12 | NOTE: You can test the methods using a main method. 13 | 14 | List ArrayList 15 | 16 | 2 17 | 18 | 1) Create an application for employee management having following classes: 19 | a) Create an Employee class with following attributes and behaviors : 20 | i) EmpId Int 21 | ii) EmpName String 22 | iii) EmpEmail String 23 | iv) EmpGender char 24 | v) EmpSalary float 25 | vi) GetEmployeeDetails() -> prints employee details 26 | 27 | b) Create one more class EmployeeDB which has the following methods. 28 | i) boolean addEmployee(Employee e) 29 | ii) boolean deleteEmployee(int empId) 30 | iii) String showPaySlip(int empId) 31 | iv) Employee[] listAll() 32 | 33 | 2) Do implementation of the above application with below two methods : 34 | I. Use an ArrayList which will be used to store the employees and use enumeration/iterator to process the employees. 35 | II. Use a TreeSet Object to store employees on the basis of their EmpId and use enumeration/iterator to process employees. [Hint: Use Comparable interface] Write a Test Program to test that all functionalities are operational. 36 | 37 | List enumeration / Iterator 38 | 39 | 3 40 | 41 | Create an ArrayList which will be able to store only Strings. Create a printAll method which will print all the elements using an Iterator. 42 | 43 | List iterator 44 | 45 | 4 46 | 47 | Create an ArrayList which will be able to store only numbers like int,float,double,etc, but not any other data type. 48 | 49 | List ArrayList 50 | 51 | 5 52 | 53 | Create an ArrayList of Employee( id,name,address,sal) objects and search for particular Employee object based on id number. 54 | 55 | List ArrayList 56 | 57 | 6 58 | 59 | Implement the assignment 1 using Linked List 60 | 61 | List Linked List 62 | 63 | 7 64 | 65 | Implement the assignment 1 using Vector 66 | 67 | List, Vector 68 | 69 | 8 70 | 71 | Write a program that will have a Vector which is capable of storing emp objects. Use an Iterator and enumeration to list all the elements of the Vector. 72 | 73 | List, Vector -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment1/Assignment1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment1/Assignment1.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment2/assignment2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment2/assignment2.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment2/bean/Employee.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment2/bean/Employee.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment2/bean/EmployeeDB.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment2/bean/EmployeeDB.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment2/service/MainTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment2/service/MainTest.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment3/Assignment3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment3/Assignment3.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment4/Assignment4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment4/Assignment4.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment4/MyArrayList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment4/MyArrayList.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment5/Assignment5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment5/Assignment5.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment5/Employee.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment5/Employee.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment6/Assignment6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment6/Assignment6.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment7/Assignment7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment7/Assignment7.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment8/Assignment8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment8/Assignment8.class -------------------------------------------------------------------------------- /bin/com/w3epic/wiprotraining/assignment8/Employee.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyberster/Wipro-Training-Collection---Assignments-for-List/d646a189a2898363753f9b04944b6f92c5c35115/bin/com/w3epic/wiprotraining/assignment8/Employee.class -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment1/Assignment1.java: -------------------------------------------------------------------------------- 1 | /* 2 | Develop a java class with a method saveEvenNumbers(int N) using ArrayList to store 3 | even numbers from 2 to N, where N is a integer which is passed as a parameter to 4 | the method saveEvenNumbers(). 5 | The method should return the ArrayList (A1) created. In the same class create a 6 | method printEvenNumbers()which iterates through the arrayList A1 in step 1, and 7 | It should multiply each number with 2 and display it in format 4,8,12….2*N. 8 | and add these numbers in a new ArrayList (A2). 9 | The new ArrayList (A2) created needs to be returned. Create a method 10 | printEvenNumber(int N) parameter is a number N. This method should search 11 | the arrayList (A1) for the existence of the number ‘N’ passed. If exists 12 | it should return the Number else return zero.Hint: Use instance variable 13 | for storing the ArrayList A1 and A2. 14 | 15 | NOTE: You can test the methods using a main method. 16 | * */ 17 | 18 | package com.w3epic.wiprotraining.assignment1; 19 | 20 | import java.util.ArrayList; 21 | 22 | public class Assignment1 { 23 | private ArrayList list = new ArrayList(); 24 | 25 | public ArrayList saveEvenNumbers(int N) { 26 | list = new ArrayList(); 27 | 28 | for (int i = 2; i <= N; i++) { 29 | if (i % 2 == 0) list.add(i); 30 | } 31 | 32 | return list; 33 | } 34 | 35 | public ArrayList printEvenNumbers() { 36 | ArrayList newList = new ArrayList(); 37 | 38 | for (int item : list) { 39 | newList.add(item * 2); 40 | System.out.println(item * 2); 41 | } 42 | 43 | return newList; 44 | } 45 | 46 | public static void main(String[] args) { 47 | Assignment1 asg = new Assignment1(); 48 | asg.saveEvenNumbers(10); 49 | asg.printEvenNumbers(); 50 | 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment2/assignment2.java: -------------------------------------------------------------------------------- 1 | package com.w3epic.wiprotraining.assignment2; 2 | 3 | public class assignment2 { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment2/bean/Employee.java: -------------------------------------------------------------------------------- 1 | package com.w3epic.wiprotraining.assignment2.bean; 2 | 3 | public class Employee { 4 | private int EmpId; 5 | private String EmpName; 6 | private String EmpEmail; 7 | private char EmpGender; 8 | private float EmpSalary; 9 | 10 | public Employee() {} 11 | 12 | public Employee(int empId, String empName, String empEmail, char empGender, float empSalary) { 13 | super(); 14 | EmpId = empId; 15 | EmpName = empName; 16 | EmpEmail = empEmail; 17 | EmpGender = empGender; 18 | EmpSalary = empSalary; 19 | } 20 | 21 | public String GetEmployeeDetails() { 22 | return "Employee [EmpId=" + EmpId + ", EmpName=" + EmpName + ", EmpEmail=" + EmpEmail 23 | + ", EmpGender=" + EmpGender + ", EmpSalary=" + EmpSalary + "]"; 24 | } 25 | 26 | public int getEmpId() { 27 | return EmpId; 28 | } 29 | 30 | public void setEmpId(int empId) { 31 | EmpId = empId; 32 | } 33 | 34 | public String getEmpName() { 35 | return EmpName; 36 | } 37 | 38 | public void setEmpName(String empName) { 39 | EmpName = empName; 40 | } 41 | 42 | public String getEmpEmail() { 43 | return EmpEmail; 44 | } 45 | 46 | public void setEmpEmail(String empEmail) { 47 | EmpEmail = empEmail; 48 | } 49 | 50 | public char getEmpGender() { 51 | return EmpGender; 52 | } 53 | 54 | public void setEmpGender(char empGender) { 55 | EmpGender = empGender; 56 | } 57 | 58 | public float getEmpSalary() { 59 | return EmpSalary; 60 | } 61 | 62 | public void setEmpSalary(float empSalary) { 63 | EmpSalary = empSalary; 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment2/bean/EmployeeDB.java: -------------------------------------------------------------------------------- 1 | package com.w3epic.wiprotraining.assignment2.bean; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | public class EmployeeDB { 8 | List employeeDb = new ArrayList<>(); 9 | 10 | public boolean addEmployee(Employee e) { 11 | return employeeDb.add(e); 12 | } 13 | 14 | public boolean deleteEmployee(int empId) { 15 | boolean isRemoved = false; 16 | 17 | Iterator it = employeeDb.iterator(); 18 | 19 | while (it.hasNext()) { 20 | Employee emp = it.next(); 21 | if (emp.getEmpId() == empId) { 22 | isRemoved = true; 23 | it.remove(); 24 | } 25 | } 26 | 27 | return isRemoved; 28 | } 29 | 30 | public String showPaySlip(int empId) { 31 | String paySlip = "Invalid employee id"; 32 | 33 | for (Employee e : employeeDb) { 34 | if (e.getEmpId() == empId) { 35 | paySlip = "Pay slip for employee id " + empId + " is " + 36 | e.getEmpSalary(); 37 | } 38 | } 39 | 40 | return paySlip; 41 | } 42 | 43 | public Employee[] listAll() { 44 | Employee[] empArray = new Employee[employeeDb.size()]; 45 | for (int i = 0; i < employeeDb.size(); i++) 46 | empArray[i] = employeeDb.get(i); 47 | return empArray; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment2/service/MainTest.java: -------------------------------------------------------------------------------- 1 | package com.w3epic.wiprotraining.assignment2.service; 2 | 3 | import com.w3epic.wiprotraining.assignment2.bean.Employee; 4 | import com.w3epic.wiprotraining.assignment2.bean.EmployeeDB; 5 | 6 | public class MainTest { 7 | 8 | public static void main(String[] args) { 9 | EmployeeDB empDb = new EmployeeDB(); 10 | 11 | Employee emp1 = new Employee(101, "Bob", "bob@w3epic.com", 'M', 25000); 12 | Employee emp2 = new Employee(102, "Alice", "alice@w3epic.com", 'F', 30000); 13 | Employee emp3 = new Employee(103, "John", "john@w3epic.com", 'M', 20000); 14 | Employee emp4 = new Employee(104, "Ram", "ram@w3epic.com", 'M', 50000); 15 | 16 | empDb.addEmployee(emp1); 17 | empDb.addEmployee(emp2); 18 | empDb.addEmployee(emp3); 19 | empDb.addEmployee(emp4); 20 | 21 | for (Employee emp : empDb.listAll()) 22 | System.out.println(emp.GetEmployeeDetails()); 23 | 24 | System.out.println(); 25 | empDb.deleteEmployee(102); 26 | 27 | for (Employee emp : empDb.listAll()) 28 | System.out.println(emp.GetEmployeeDetails()); 29 | 30 | System.out.println(); 31 | 32 | System.out.println(empDb.showPaySlip(103)); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment3/Assignment3.java: -------------------------------------------------------------------------------- 1 | /* 2 | Create an ArrayList which will be able to store only Strings. Create a printAll 3 | method which will print all the elements using an Iterator. 4 | * */ 5 | 6 | package com.w3epic.wiprotraining.assignment3; 7 | 8 | import java.util.ArrayList; 9 | import java.util.Iterator; 10 | import java.util.List; 11 | 12 | public class Assignment3 { 13 | 14 | public static void main(String[] args) { 15 | List list = new ArrayList<>(); 16 | list.add("Item 1"); 17 | list.add("Item 2"); 18 | list.add("Item 3"); 19 | list.add("Item 4"); 20 | 21 | printAll(list); 22 | } 23 | 24 | public static void printAll(List list) { 25 | Iterator it = list.iterator(); 26 | 27 | while (it.hasNext()) 28 | System.out.println(it.next()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment4/Assignment4.java: -------------------------------------------------------------------------------- 1 | /* 2 | Create an ArrayList which will be able to store only numbers like 3 | int, float, double, etc, but not any other data type. 4 | * */ 5 | 6 | package com.w3epic.wiprotraining.assignment4; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | // ref: http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/00cd9dc3c2b5/src/share/classes/java/util/ArrayList.java 12 | class MyArrayList extends ArrayList { 13 | @Override 14 | public boolean add(E e) { 15 | if (e instanceof Integer || e instanceof Float || e instanceof Double) { 16 | super.add(e); 17 | return true; 18 | } else { 19 | throw new ClassCastException("Only Integer, Float, and Double are supported."); 20 | } 21 | } 22 | } 23 | 24 | public class Assignment4 { 25 | 26 | public static void main(String[] args) { 27 | List list = new MyArrayList<>(); 28 | 29 | try { 30 | list.add(15); 31 | list.add(1.2F); 32 | list.add(3.1415D); 33 | list.add("Test"); 34 | } catch (Exception e) { 35 | e.printStackTrace(); 36 | } 37 | 38 | System.out.println(list); 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment5/Assignment5.java: -------------------------------------------------------------------------------- 1 | /* 2 | Create an ArrayList of Employee( id,name,address,sal) objects and search 3 | for particular Employee object based on id number. 4 | */ 5 | 6 | package com.w3epic.wiprotraining.assignment5; 7 | 8 | import java.util.ArrayList; 9 | import java.util.Iterator; 10 | import java.util.List; 11 | 12 | class Employee { 13 | private int id; 14 | private String name; 15 | private String address; 16 | private Double salary; 17 | 18 | public Employee(int id, String name, String address, Double salary) { 19 | super(); 20 | this.id = id; 21 | this.name = name; 22 | this.address = address; 23 | this.salary = salary; 24 | } 25 | 26 | public int getId() { 27 | return id; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return "Employee [id=" + id + ", name=" + name + ", address=" + address + ", salary=" + salary + "]"; 33 | } 34 | } 35 | 36 | public class Assignment5 { 37 | 38 | public static void main(String[] args) { 39 | List list = new ArrayList<>(); 40 | 41 | list.add(new Employee(101, "Bob", "123 street, India", 20000.0)); 42 | list.add(new Employee(102, "Alice", "234 street, India", 30000.0)); 43 | list.add(new Employee(103, "John", "345 street, India", 25000.0)); 44 | list.add(new Employee(104, "Stuart", "456 street, India", 40000.0)); 45 | 46 | Iterator it = list.iterator(); 47 | int searchId = 102; 48 | while (it.hasNext()) { 49 | Employee emp = it.next(); 50 | if (emp.getId() == searchId) 51 | System.out.println(emp); 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment6/Assignment6.java: -------------------------------------------------------------------------------- 1 | /* 2 | Implement the assignment 1 using Linked List 3 | * */ 4 | 5 | package com.w3epic.wiprotraining.assignment6; 6 | 7 | import java.util.LinkedList; 8 | 9 | import com.w3epic.wiprotraining.assignment1.Assignment1; 10 | 11 | public class Assignment6 { 12 | private LinkedList list = new LinkedList(); 13 | 14 | public LinkedList saveEvenNumbers(int N) { 15 | list = new LinkedList(); 16 | 17 | for (int i = 2; i <= N; i++) { 18 | if (i % 2 == 0) list.add(i); 19 | } 20 | 21 | return list; 22 | } 23 | 24 | public LinkedList printEvenNumbers() { 25 | LinkedList newList = new LinkedList(); 26 | 27 | for (int item : list) { 28 | newList.add(item * 2); 29 | System.out.println(item * 2); 30 | } 31 | 32 | return newList; 33 | } 34 | 35 | public static void main(String[] args) { 36 | Assignment1 asg = new Assignment1(); 37 | asg.saveEvenNumbers(10); 38 | asg.printEvenNumbers(); 39 | 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment7/Assignment7.java: -------------------------------------------------------------------------------- 1 | /* 2 | Implement the assignment 1 using Vector 3 | * */ 4 | 5 | package com.w3epic.wiprotraining.assignment7; 6 | 7 | import java.util.Vector; 8 | 9 | import com.w3epic.wiprotraining.assignment1.Assignment1; 10 | 11 | public class Assignment7 { 12 | private Vector list = new Vector(); 13 | 14 | public Vector saveEvenNumbers(int N) { 15 | list = new Vector(); 16 | 17 | for (int i = 2; i <= N; i++) { 18 | if (i % 2 == 0) list.add(i); 19 | } 20 | 21 | return list; 22 | } 23 | 24 | public Vector printEvenNumbers() { 25 | Vector newList = new Vector(); 26 | 27 | for (int item : list) { 28 | newList.add(item * 2); 29 | System.out.println(item * 2); 30 | } 31 | 32 | return newList; 33 | } 34 | 35 | public static void main(String[] args) { 36 | Assignment1 asg = new Assignment1(); 37 | asg.saveEvenNumbers(10); 38 | asg.printEvenNumbers(); 39 | 40 | 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /src/com/w3epic/wiprotraining/assignment8/Assignment8.java: -------------------------------------------------------------------------------- 1 | /* 2 | Write a program that will have a Vector which is capable of storing emp objects. 3 | Use an Iterator and enumeration to list all the elements of the Vector. 4 | * */ 5 | package com.w3epic.wiprotraining.assignment8; 6 | 7 | import java.util.Iterator; 8 | import java.util.Vector; 9 | 10 | class Employee { 11 | private int id; 12 | private String name; 13 | private String address; 14 | private Double salary; 15 | 16 | public Employee(int id, String name, String address, Double salary) { 17 | super(); 18 | this.id = id; 19 | this.name = name; 20 | this.address = address; 21 | this.salary = salary; 22 | } 23 | 24 | public int getId() { 25 | return id; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return "Employee [id=" + id + ", name=" + name + ", address=" + address + ", salary=" + salary + "]"; 31 | } 32 | } 33 | 34 | public class Assignment8 { 35 | 36 | public static void main(String[] args) { 37 | Vector list = new Vector<>(); 38 | 39 | list.add(new Employee(101, "Bob", "123 street, India", 20000.0)); 40 | list.add(new Employee(102, "Alice", "234 street, India", 30000.0)); 41 | list.add(new Employee(103, "John", "345 street, India", 25000.0)); 42 | list.add(new Employee(104, "Stuart", "456 street, India", 40000.0)); 43 | 44 | Iterator it = list.iterator(); 45 | while (it.hasNext()) 46 | System.out.println(it.next()); 47 | 48 | 49 | } 50 | 51 | } 52 | --------------------------------------------------------------------------------