I know there is a way for writing a Java if statement in short form.
if (city.getName() != null) {
name = city.getName();
} else {
name=
I'm always forgeting how to use the ?: ternary operator. This supplemental answer is a quick reminder. It is shorthand for if-then-else.
myVariable = (testCondition) ? someValue : anotherValue;
where
() holds the if? means then: means elseIt is the same as
if (testCondition) {
myVariable = someValue;
} else {
myVariable = anotherValue;
}