public static Landmark getClosestLandmark(double currentlat, double currentlon) { Landmark ret = null; double closest = 99999; double lmlat; double lmlon; for ( int i = 0 ; i < LandmarkList.size() ; i++ ) { QualifiedCoordinates qc = ((Landmark) LandmarkList.elementAt(i)).getQualifiedCoordinates(); lmlat = qc.getLatitude(); lmlon = qc.getLongitude(); double dist = Location.getdistance(currentlat, currentlon, lmlat, lmlon ); if ( dist < closest ) { ret = (Landmark) LandmarkList.elementAt(i); closest = dist; } } return ret; }