I know there is a way for writing a Java if statement in short form.
if (city.getName() != null) {
name = city.getName();
} else {
name=
name = ( (city.getName() == null)? "N/A" : city.getName() );
firstly the condition (city.getName() == null) is checked. If yes, then "N/A" is assigned to name or simply name="N/A" or else the value from city.getName() is assigned to name, i.e. name=city.getName().
Things to look out here:
(city.getName() == null)?. Here the question mark is right after the condition. Easy to see/read/guess even!:) and value right of colon
(a) value left of colon is assigned when condition is true, else the value right of colon is assigned to the variable. here's a reference: http://www.cafeaulait.org/course/week2/43.html