Say I have the following class
class Application {
public Application() {...}
public void doSomething(final String logs) {
final String[] lines = logs.split("\\n");
for (final String line: lines) {
// Pass the line to every single checkForProp# item and do something with the response
}
}
private Optional<Action> checkForProp1(final String line) {
// Check if line has certain thing
// If so return an Action
}
// More of these "checks" here
}
Let's say every single response, would be added to a queue, and then returned something is done on that queue.
So instead of I calling each method manually, I want to have maybe an array of checker methods, and automatically loop through them, pass in the line, and add the response to a queue.
Can this be achieved?
interfacefor this