Skip to content

Instantly share code, notes, and snippets.

@mjedynak
Last active April 1, 2018 19:53
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