Advertisement
GeneralGDA

Untitled

Apr 21st, 2022
1,195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. class Stack {
  2.     private final ArrayList<float> backend;
  3.     public void push(float value) {
  4.     }
  5. }
  6.  
  7. interface Command {
  8.     void Execute(Stack target);
  9. }
  10.  
  11. class CommandPush implements Command {
  12.     @Override
  13.     public void Execute(Stack target) {
  14.         target.push();
  15.     }
  16. }
  17.  
  18. private java.util.HashMap<String, Callable<Command>> commandsConstructor;
  19.  
  20. void prepareCommands() {
  21.     commandsConstructor = new HashMap<>();
  22.     commandsConstructor.put("PUSH", o -> new PushCommand());
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement