The evolution of Lambda
Hi Guys, Let us look at the behavioral parameter pattern, the base of lambda function and the evolution of lambda function. Change is inevitable. Requirements do change. It is the ability of the software to respond well that makes it stand out in the crowd. Behavioral parameter pattern lets us handle frequent changes in the most beautiful way. Let us discuss with an example. Requirement: We have a list of employees. We want to filter only full time employees. How can we write java code for this. Solution 1: public List<Employee> filterFulltimeEmployee(List<Employee> employees) { List<Employee> filteredEmployees = new ArrayList<>(); for(Employee employee : employees) { if(employee.isFulltimeEmployee) filteredEmployees.add(employee); } return filteredEmployees; } Fine. Now instead of full time employees, we need part time employees. A naive solution would be ...