I have a method with an optional string parameter. The default string value for this parameter needs to be created based on one of the other inputs. So I can't define the default value directly in the method parameters. I could set the default value to null and then check for that, however if the string provided was actually null this could create some difficult situations to debug. Is there a way to check if a parameter was actually provided?
public static method(String input1, String input2 = null)
{
if (noSecondParameter())
{
input2 = getDefaultInput(input1)
}
}