Created
September 29, 2019 07:09
-
-
Save senthil1216/fc322bf95190f69e43e271d14550f7d4 to your computer and use it in GitHub Desktop.
Consumer Example Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConsumerExampleDemo { | |
Employees employees; | |
Consumer consumer; | |
public ConsumerExampleDemo(Consumer consumer) { | |
employees = new Employees(); | |
// employees = prepareEmployees(employees); // Look at the implementation for this method in the above Non-Consumer way | |
this.consumer = consumer; | |
} | |
public void executeConsumers() { | |
for(Employee e: employees.getEmployees()) { | |
this.consumer.accept(e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment