public static void deleteEmployee(int empId) {
Iterator<Employee> iterator = list1.iterator();
while (iterator.hasNext()) {
if (iterator.next().getEmpid() == empId) {
System.out.println("The name of whose details deleted is ::");
iterator.remove();
}
}
}
Here I am trying to delete node from arraylist based on employee id. But before deleting I want to show the details of particular employee. How can I do that?
removebut it would be fine with arraylist