I have method
public List getListaDataTable(param1, param2, param3)
Method must call to others method depends witch params is null. If I do it with if ... else I going to do 7 condition. Any idea how resolve this?
THX
I have method
public List getListaDataTable(param1, param2, param3)
Method must call to others method depends witch params is null. If I do it with if ... else I going to do 7 condition. Any idea how resolve this?
THX
char[] code = {'0', '0', '0'};
if (param1 != null) code[0] = '1';
if (param2 != null) code[1] = '1';
if (param3 != null) code[2] = '1';
String codeString = String.copyValueOf(code);
switch (codeString) {
case "000":
//all are null
break;
case "100":
//param1 is not null
...
}
You can surcharge your function with no null parameters
public List getListaDataTable(param1, param2, param3, param4, param5, param6, param7)
{
// Do function A
// Do function C
public List getListaDataTable(param1, param2, param3, param4, param7)
{
// Do function B
// Do function C