Skip to content

Instantly share code, notes, and snippets.

@renanreismartins
Last active December 21, 2015 23:49
Show Gist options
  • Save renanreismartins/6384684 to your computer and use it in GitHub Desktop.
Save renanreismartins/6384684 to your computer and use it in GitHub Desktop.
public Option<String> fazAlgo() {
if(se tenho valor retornarei um Some com o valor) {
return new Some<String>(valor);
} else {
// não tenho valor, ao invés de retornar nulo
//e correr o risco do código cliente chamar um método em null, retornarei um None
return new None<String>();
}
}
// Option<String> option = fazAlgo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment