You can, for example, declare an interface, for example:
public interface Processor { void process(String arg); }
then we implement this interface, for example, in single games.
Then create a Map<String, Processor> , where your lines are indicated, values ββare implementations, and when called:
Processor p = theMap.containsKey(theString) ? theMap.get(theString) : defaultProcessor; p.process(theString);
source share