Skip to content

Instantly share code, notes, and snippets.

@LukaJCB
Created July 30, 2016 10:47
Show Gist options
  • Save LukaJCB/3c904567ee9b16d95caf5679bddcf2cf to your computer and use it in GitHub Desktop.
Save LukaJCB/3c904567ee9b16d95caf5679bddcf2cf to your computer and use it in GitHub Desktop.
String constructionFirm = person.getResidence().getAddress().getConstructionFirm();
//Can't do this because residence, address or constructionFirm could be null.
String constructionFirm = null;
if(person != null){
Residence residence = person.getResidence();
if(residence != null){
Address address = residence.getAddress();
if(address != null){
constructionFirm = adress.getConstructionFirm();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment