Created
January 26, 2012 15:28
-
-
Save jlindenbaum/1683280 to your computer and use it in GitHub Desktop.
"Caching" in Object fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a new GeoPoint only if | |
* a GeoPoint object does not exist | |
* within the object already | |
*/ | |
public GeoPoint getGeoPoint() { | |
if (this.geoPoint == null) { | |
this.geoPoint = new GeoPoint(this.lat, this.lng); | |
} | |
return this.geoPoint; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment