I want to return two objects from a Java method and was wondering what could be a good way of doing so?
The possible ways I can think of are: return a HashMap<
Pass a list to your method and populate it, then return the String with the names, like this:
public String buildList(List> list) {
list.add(1);
list.add(2);
list.add(3);
return "something,something,something,dark side";
}
Then call it like this:
List> values = new ArrayList>();
String names = buildList(values);