Skip to content

Instantly share code, notes, and snippets.

@mjedynak
Last active April 1, 2018 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjedynak/35a67287fcd1bb2a62372966ed254d3b to your computer and use it in GitHub Desktop.
Save mjedynak/35a67287fcd1bb2a62372966ed254d3b to your computer and use it in GitHub Desktop.
public class CityRetriever {
private final PersonService personService;
public String retrieveCity(String name) {
Person person = personService.getByName(name);
if (person != null) {
Address address = person.getAddress();
if (address != null) {
if (address.getCity() != null) {
return address.getCity();
}
}
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment