I am trying to take in multiple parameters from a function and im am checking if at least one of the parameters are not null or empty.
right now i am doing something like this.
void foo(String a, String b, String c, String d, ... other strings){
//make sure at least one of the inputs are not null.
if(a!=null || b!=null || c!=null || d!=null ... more strings){
//do something with the string
}
}
so an input can be foo(null, null, null, "hey");
but it cannot be foo(null, null, null, null);
What my question is is there a better way to do this, rather than keep adding to the if statement. Im blanking out right now…. Thanks
Use varags
Returns true if at least one string is empty