Last active
December 21, 2015 23:49
-
-
Save renanreismartins/6384684 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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