app/src/main/java/com/example/android/quakereport/QueryUtils.java
/**
     * Return an {@link List} object by parsing out information
     * about the first earthquake from the input earthquakeJSON string.
     */
Return an  List object by parsing out information
about the first earthquake from the input earthquakeJSON string.
Return an List object by parsing out information about the first earthquake from the input earthquakeJSON string .
private static List<Earthquake> extractFeatureFromJson(String earthquakeJSON) {
        if (TextUtils.isEmpty(earthquakeJSON)) {
            return null;
        }
        ArrayList<Earthquake> earthquakes = new ArrayList<>();
        try {
            JSONObject baseJsonResponse = new JSONObject(earthquakeJSON);
            JSONArray featureArray = baseJsonResponse.getJSONArray("features");
            for (int i = 0; i < featureArray.length(); i++) {
                JSONObject currentEarthquake = featureArray.getJSONObject(i);
                JSONObject properties = currentEarthquake.getJSONObject("properties");
                double magnitude = properties.getDouble("mag");
                String location = properties.getString("place");
                long time = properties.getLong("time");
                String Url = properties.getString("url");
                Earthquake earthquake = new Earthquake(magnitude, location, time, Url);
                earthquakes.add(earthquake);
            }
        } catch (JSONException e) {
            Log.e(LOG_TAG, "Problem parsing the earthquake JSON results", e);
        }
        return earthquakes;
    }
private static List < Earthquake > extractFeatureFromJson ( String earthquakeJSON ) { if ( TextUtils . isEmpty ( earthquakeJSON ) ) { return null ; } ArrayList < Earthquake > earthquakes = new ArrayList < > ( ) ; try { JSONObject baseJsonResponse = new JSONObject ( earthquakeJSON ) ; JSONArray featureArray = baseJsonResponse . getJSONArray ( "features" ) ; for ( int i = 0 ; i < featureArray . length ( ) ; i ++ ) { JSONObject currentEarthquake = featureArray . getJSONObject ( i ) ; JSONObject properties = currentEarthquake . getJSONObject ( "properties" ) ; double magnitude = properties . getDouble ( "mag" ) ; String location = properties . getString ( "place" ) ; long time = properties . getLong ( "time" ) ; String Url = properties . getString ( "url" ) ; Earthquake earthquake = new Earthquake ( magnitude , location , time , Url ) ; earthquakes . add ( earthquake ) ; } } catch ( JSONException e ) { Log . e ( LOG_TAG , "Problem parsing the earthquake JSON results" , e ) ; } return earthquakes ; }
Return an {@link List} object by parsing out information
 about the first earthquake from the input earthquakeJSON string.
Return an { @link List } object by parsing out information about the first earthquake from the input earthquakeJSON string .
// If the JSON string is empty or null, then return early.