Skip to content

Instantly share code, notes, and snippets.

@tkfx
Created July 5, 2016 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tkfx/2042e420b6c7033070ab4e653932a509 to your computer and use it in GitHub Desktop.
Save tkfx/2042e420b6c7033070ab4e653932a509 to your computer and use it in GitHub Desktop.
// simple constructor
//
private final int x;
private final int y;
private final String z;
public MyClass(int x, int y, String z) {
this.x = x;
this.y = y;
this.z = z;
}
// complex building
//
public static MyClass create(List<Stuff> list, Set<Stuff> set) {
// int x = some brains...
// int y = more brains...
// other brains...
// String z = more complex stuff here
//
return new MyClass(x, y, z);
}
private final int x;
private final int y;
private final String z;
private MyClass(int x, int y, String z) {
this.x = x;
this.y = y;
this.z = z;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment