I have a list of Employee, and I want to retrieve only one Employee information with the specific name:
public static Employee getAllEmployeeDetails(String employeeName) {
List<Employee> empList = getAllEmployeeDetails();
Employee employee = empList.stream().filter(x -> x.equals(employeeName));
return employee;
}
Please let me know how to filter the data and return a single element.