Open manucapo opened 2 years ago
One possibility could be to implement a helper method that takes a custom data structure as a parameter and then distributes the needed information to the program as necessary.
That way the user only needs to interact with the program through a single API endpoint.
In other words:
The goal is to replace our current main() method by a single function call that takes as little parameters as possible
Not quite sure how to do it the described way but this is what I managed :
private static HashMap<String, String> parseInput(String input) {
HashMap<String, String> map = new HashMap<String, String>();
List
List<String> values = Arrays.asList(input.split("\\s+"));
for(int i=0; i<parameters.size(); i++){
map.put(parameters.get(i), values.get(i));
}
return map;
}
Currently Information is passed by the user to the program piece by piece.
For example
Can we package the required information in a better way so that only one parameter needs to be passed to the API ?