I have one Main class and VOCollection Class.
in main class there is a method called getStatus(), from this method only i am getting some status(true,false), if the status is true, i need to return a collection.
at present i have two ideas, but both are expensive.
-
return map, it’s expensive because setting Boolean for collection make confusion in code, and only one Boolean value is enough (but we are returning multiple).
-
creating an instance variable in VOCollection class, and having getter & setter to get & set the Boolean value. this is also expensive. (creating a variable in another class).
give me less expensive solution.
There are a number of ways to do this:
boolean method(List[] result) {
result[0] = answer;
return flag;
}
Pair method() {
return new Pair(flag, answer);
}