private String getDisplayName(Feature feature) { String result = getProperty(feature, "name"); if(result.length() > 0) result += ", "; String postcode = getProperty(feature, "postcode"); if(postcode.length() > 0) result += postcode; String city = getProperty(feature, "city"); if(city.length() > 0) result += " " + city; String state = getProperty(feature, "state"); if(state.length() > 0) result += ", " + state; String country = getProperty(feature, "country"); if(country.length() > 0) result += ", " + country; result = result.replaceAll(" {2}", " "); if(result.endsWith(", ")) result = result.substring(0, result.length() - 2); return result; } }