如何在列表中搜索?有没有内置功能?
public void searchEmployee(int empId) {
Iterator<Employee> iterator = list1.iterator();
while (iterator.hasNext()) {
if (iterator.next().getEmpid() == empId) {
System.out.println("the searched employee is ::");
iterator.remove();
}
}
}