Skip to content

Instantly share code, notes, and snippets.

@evanchooly
Created July 23, 2013 14:18
Show Gist options
  • Save evanchooly/6062704 to your computer and use it in GitHub Desktop.
Save evanchooly/6062704 to your computer and use it in GitHub Desktop.
optional parameters
public void something(X x, Y y) {
something(x, y, someDefaultValue);
}
public void something(X x, Y y, SomeObject object) {
// do work
}
// vs
public void something(X x, Y y, SomeObject... objects) {
SomeObject object = object.length == 0 ? someDefaultValue : object[0];
// do work
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment