I am writing a small processor. To store the functions, I am using a HashMap<String, Command> commands
, which holds classes that implement the interface command
. Those classes, along with the interface, are in their own package Commands
Currently, I am using a bunch of commands.put(...)
instructions to fill the HashMap.
I would like to make the filling of the HashMap iterative, so that I can just create or delete classes that implement the interface command
without having to worry about updating the HashMap. Is something like this possible without too much hassle?