Chain of Command
public interface Command<T>{ boolean execute(T context); } public class FirstCommand implements Command<Map<String, Object>>{ public boolean execute(Map<String, Object> context){ //doing something in here } } public class SecondCommand implements Command<Map<String, Object>>{ public boolean execute(Map<String, Object> context){ //doing something in here } } public class Chain { public List<Command> commands; public Chain(Command... commands){ this.commands = Arrays.asList(commands); } public void start(Object context){ for(Command command : commands){ boolean shouldStop = command.execute(context); i...